diff --git a/go.mod b/go.mod index 3334814..f58e77c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/obalunenko/strava-api -go 1.25.0 +go 1.26.2 require ( github.com/go-openapi/errors v0.22.7 @@ -8,7 +8,7 @@ require ( github.com/go-openapi/strfmt v0.26.1 github.com/go-openapi/swag v0.26.0 github.com/go-openapi/validate v0.25.2 - github.com/obalunenko/getenv v1.14.1 + github.com/obalunenko/getenv v1.14.2 github.com/stretchr/testify v1.11.1 ) @@ -42,7 +42,6 @@ require ( go.opentelemetry.io/otel/metric v1.43.0 // indirect go.opentelemetry.io/otel/trace v1.43.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa // indirect golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/go.sum b/go.sum index b096377..8d1a271 100644 --- a/go.sum +++ b/go.sum @@ -65,8 +65,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/obalunenko/getenv v1.14.1 h1:nFwG6PMKWKNBWnvlCbIOLgYdj/sSerbLZ9k3Is26HOU= -github.com/obalunenko/getenv v1.14.1/go.mod h1:O+JIpb//raW/4Mx6sno6lHckuFn7zbagod0KkyDHUX0= +github.com/obalunenko/getenv v1.14.2 h1:TDYbrAOscHaL6Qw5iG3QYE1Lhigk0TSv2GHe370XkxM= +github.com/obalunenko/getenv v1.14.2/go.mod h1:kXJjGqFmvucspwNk4/hrHi2bG3cEfSEQJPYmWzUK/KQ= github.com/oklog/ulid/v2 v2.1.1 h1:suPZ4ARWLOJLegGFiZZ1dFAkqzhMjL3J1TzI+5wHz8s= github.com/oklog/ulid/v2 v2.1.1/go.mod h1:rcEKHmBBKfef9DhnvX7y1HZBYxjXb0cP5ExxNsTT1QQ= github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= @@ -88,8 +88,6 @@ go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09 go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa h1:t2QcU6V556bFjYgu4L6C+6VrCPyJZ+eyRsABUPs1mz4= -golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk= golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/vendor/github.com/obalunenko/getenv/.gitignore b/vendor/github.com/obalunenko/getenv/.gitignore index e948fb7..55fa65f 100644 --- a/vendor/github.com/obalunenko/getenv/.gitignore +++ b/vendor/github.com/obalunenko/getenv/.gitignore @@ -20,4 +20,7 @@ dist/ coverage/ .DS_Store tests-report.json -README_doc.md \ No newline at end of file +README_doc.md +.vscode/ + +linters-report.xml diff --git a/vendor/github.com/obalunenko/getenv/.golangci.pipe.yml b/vendor/github.com/obalunenko/getenv/.golangci.pipe.yml index 1ebe5b2..07b5668 100644 --- a/vendor/github.com/obalunenko/getenv/.golangci.pipe.yml +++ b/vendor/github.com/obalunenko/getenv/.golangci.pipe.yml @@ -1,132 +1,87 @@ -linters: - disable-all: true - enable: - - govet - - errcheck - - gofmt - - revive - - goimports - - unused - - gosimple - -linters-settings: - errcheck: - check-type-assertions: true - check-blank: true - gofmt: - simplify: true - goimports: - local-prefixes: github.com/obalunenko/getenv/ - revive: - # see https://github.com/mgechev/revive#available-rules for details. - ignore-generated-header: true - severity: warning - rules: - - name: indent-error-flow - severity: warning - - name: exported - severity: warning - - name: defer - severity: warning - arguments: [ [ "call-chain", "loop", "method-call", "recover", "return" ] ] - -issues: - # make issues output unique by line, default is true - uniq-by-line: true - exclude-use-default: false - exclude: - # for "public interface + private struct implementation" cases only! - - exported func * returns unexported type *, which can be annoying to use - - should have a package comment, unless it's in another file for this package - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - # Exclude some linters from running on tests files. - - path: _test\.go - linters: - - gocyclo - - funlen - - dupl - - gosec - - path: internal/input/ - linters: - - gocyclo - - funlen - - godot - - godox - - dupl - - gofmt - - gci - - gofumpt - - goimports - - gosimple - - path: internal/puzzles/constants.go - linters: - - revive - - # Show only new issues: if there are unstaged changes or untracked files, - # only those changes are analyzed, else only changes in HEAD~ are analyzed. - # It's a super-useful option for integration of golangci-lint into existing - # large codebase. It's not practical to fix all existing issues at the moment - # of integration: much better don't allow issues in new code. - # Default is false. - new: true - - # Fix found issues (if it's supported by the linter) - fix: false - - severity: - # Default value is empty string. - # Set the default severity for issues. If severity rules are defined and the issues - # do not match or no severity is provided to the rule this will be the default - # severity applied. Severities should match the supported severity names of the - # selected out format. - # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity - # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity - # - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message - default-severity: error - - # The default value is false. - # If set to true severity-rules regular expressions become case sensitive. - case-sensitive: false - - # Default value is empty list. - # When a list of severity rules are provided, severity information will be added to lint - # issues. Severity rules have the same filtering capability as exclude rules except you - # are allowed to specify one matcher per severity rule. - # Only affects out formats that support setting severity information. - rules: - - linters: - - dupl - severity: warning - +version: "2" run: issues-exit-code: 1 tests: true - exclude-dirs: - - vendor/ - exclude-files: - - \.pb\.go$ - -# output configuration options output: - # colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions - # default is "colored-line-number" formats: - - format: colored-line-number + text: path: stderr - - format: checkstyle + print-linter-name: true + print-issued-lines: true + checkstyle: path: linters-report.xml - - # print lines of code with issue, default is true - print-issued-lines: true - - # print linter name in the end of issue text, default is true - print-linter-name: true - - # add a prefix to the output file references; default is no prefix path-prefix: "" - - # sorts results by: filepath, line and column - sort-results: true - - +linters: + default: none + enable: + - errcheck + - govet + - revive + - staticcheck + - unused + settings: + errcheck: + check-type-assertions: true + check-blank: true + revive: + severity: warning + rules: + - name: indent-error-flow + severity: warning + - name: exported + severity: warning + - name: defer + arguments: + - - call-chain + - loop + - method-call + - recover + - return + severity: warning + exclusions: + generated: lax + rules: + - linters: + - dupl + - funlen + - gocyclo + - gosec + path: _test\.go + - linters: + - dupl + - funlen + - gocyclo + - godot + - godox + - staticcheck + path: internal/input/ + - linters: + - revive + path: internal/puzzles/constants.go + - path: (.+)\.go$ + text: exported func * returns unexported type *, which can be annoying to use + - path: (.+)\.go$ + text: should have a package comment, unless it's in another file for this package + paths: + - third_party$ + - builtin$ + - examples$ +issues: + uniq-by-line: true +formatters: + enable: + - gofmt + - goimports + settings: + gofmt: + simplify: true + goimports: + local-prefixes: + - github.com/obalunenko/getenv/ + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ + - internal/input/ diff --git a/vendor/github.com/obalunenko/getenv/.golangci.yml b/vendor/github.com/obalunenko/getenv/.golangci.yml index a6c4f99..64f6701 100644 --- a/vendor/github.com/obalunenko/getenv/.golangci.yml +++ b/vendor/github.com/obalunenko/getenv/.golangci.yml @@ -1,356 +1,197 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by github.com/obalunenko/logger - dupl: - threshold: 100 - funlen: - lines: 100 - statements: 50 - gci: - # Section configuration to compare against. - # Section names are case-insensitive and may contain parameters in (). - # The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`, - # If `custom-order` is `true`, it follows the order of `sections` option. - # Default: ["standard", "default"] - sections: - - standard # Standard section: captures all standard packages. - - default # Default section: contains all imports that could not be matched to another section type. - - prefix(github.com/obalunenko) # Custom section: groups all imports with the specified Prefix. - - localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled. - - # Skip generated files. - # Default: true - skip-generated: true - - # Enable custom order of sections. - # If `true`, make the section order the same as the order of `sections`. - # Default: false - custom-order: true - - # Drops lexical ordering for custom sections. - # Default: false - no-lex-order: true - - goconst: - min-len: 2 - min-occurrences: 2 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - hugeParam - - octalLiteral - - wrapperFunc - gocyclo: - min-complexity: 15 - goimports: - local-prefixes: github.com/obalunenko/getenv - mnd: - # List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. - # Default: ["argument", "case", "condition", "operation", "return", "assign"] - checks: - - argument - - case - - condition - - operation - - return - - assign - # List of numbers to exclude from analysis. - # The numbers should be written as string. - # Values always ignored: "1", "1.0", "0" and "0.0" - # Default: [] - ignored-numbers: [] - # List of file patterns to exclude from analysis. - # Values always ignored: `.+_test.go` - # Default: [] - ignored-files: [] - # List of function patterns to exclude from analysis. - # Following functions are always ignored: `time.Date`, - # `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`, - # `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`. - # Default: [] - ignored-functions: [] - - govet: - # Disable all analyzers. - # Default: false - disable-all: false - # Enable analyzers by name. - # (in addition to default: - # appends, asmdecl, assign, atomic, bools, buildtag, cgocall, composites, copylocks, defers, directive, errorsas, - # framepointer, httpresponse, ifaceassert, loopclosure, lostcancel, nilfunc, printf, shift, sigchanyzer, slog, - # stdmethods, stringintconv, structtag, testinggoroutine, tests, timeformat, unmarshal, unreachable, unsafeptr, - # unusedresult - # ). - # Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers. - # Default: [] - disable: - - fieldalignment - enable: - # Check for missing values after append. - - appends - # Report mismatches between assembly files and Go declarations. - - asmdecl - # Check for useless assignments. - - assign - # Check for common mistakes using the sync/atomic package. - - atomic - # Check for non-64-bits-aligned arguments to sync/atomic functions. - - atomicalign - # Check for common mistakes involving boolean operators. - - bools - # Check //go:build and // +build directives. - - buildtag - # Detect some violations of the cgo pointer passing rules. - - cgocall - # Check for unkeyed composite literals. - - composites - # Check for locks erroneously passed by value. - - copylocks - # Check for calls of reflect.DeepEqual on error values. - - deepequalerrors - # Report common mistakes in defer statements. - - defers - # Check Go toolchain directives such as //go:debug. - - directive - # Report passing non-pointer or non-error values to errors.As. - - errorsas - # Find calls to a particular function. - - findcall - # Report assembly that clobbers the frame pointer before saving it. - - framepointer - # Check for mistakes using HTTP responses. - - httpresponse - # Detect impossible interface-to-interface type assertions. - - ifaceassert - # Check references to loop variables from within nested functions. - - loopclosure - # Check cancel func returned by context.WithCancel is called. - - lostcancel - # Check for useless comparisons between functions and nil. - - nilfunc - # Check for redundant or impossible nil comparisons. - - nilness - # Check consistency of Printf format strings and arguments. - - printf - # Check for comparing reflect.Value values with == or reflect.DeepEqual. - - reflectvaluecompare - # Check for possible unintended shadowing of variables. - - shadow - # Check for shifts that equal or exceed the width of the integer. - - shift - # Check for unbuffered channel of os.Signal. - - sigchanyzer - # Check for invalid structured logging calls. - - slog - # Check the argument type of sort.Slice. - - sortslice - # Check signature of methods of well-known interfaces. - - stdmethods - # Check for string(int) conversions. - - stringintconv - # Check that struct field tags conform to reflect.StructTag.Get. - - structtag - # Report calls to (*testing.T).Fatal from goroutines started by a test. - - testinggoroutine - # Check for common mistaken usages of tests and examples. - - tests - # Check for calls of (time.Time).Format or time.Parse with 2006-02-01. - - timeformat - # Report passing non-pointer or non-interface values to unmarshal. - - unmarshal - # Check for unreachable code. - - unreachable - # Check for invalid conversions of uintptr to unsafe.Pointer. - - unsafeptr - # Check for unused results of calls to some functions. - - unusedresult - # Checks for unused writes. - - unusedwrite - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - +version: "2" +run: + issues-exit-code: 0 + tests: true +output: + formats: + text: + path: stderr + print-linter-name: true + print-issued-lines: true + checkstyle: + path: linters-report.xml + sort-order: + - linter + - severity + - file + path-prefix: "" linters: - disable-all: true + default: none enable: - bodyclose + - copyloopvar - depguard - dogsled - dupl - errcheck - - copyloopvar - funlen - gochecknoinits - goconst - gocritic - gocyclo - - gofmt - - goimports - - mnd - goprintffuncname - gosec - - gosimple - govet - ineffassign - lll - misspell + - mnd - nakedret - noctx - nolintlint + - revive - rowserrcheck - staticcheck - - stylecheck - - typecheck - unconvert - unparam - unused - whitespace - - revive - - wsl - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - + - wsl_v5 + settings: + depguard: + rules: + logger: + deny: + - pkg: github.com/sirupsen/logrus + desc: logging is allowed only by github.com/obalunenko/logger + dupl: + threshold: 100 + funlen: + lines: 100 + statements: 50 + goconst: + min-len: 2 + min-occurrences: 2 + gocritic: + disabled-checks: + - dupImport + - ifElseChain + - hugeParam + - octalLiteral + - wrapperFunc + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + gocyclo: + min-complexity: 15 + govet: + enable: + - appends + - asmdecl + - assign + - atomic + - atomicalign + - bools + - buildtag + - cgocall + - composites + - copylocks + - deepequalerrors + - defers + - directive + - errorsas + - findcall + - framepointer + - httpresponse + - ifaceassert + - loopclosure + - lostcancel + - nilfunc + - nilness + - printf + - reflectvaluecompare + - shadow + - shift + - sigchanyzer + - slog + - sortslice + - stdmethods + - stringintconv + - structtag + - testinggoroutine + - tests + - timeformat + - unmarshal + - unreachable + - unsafeptr + - unusedresult + - unusedwrite + disable: + - fieldalignment + disable-all: false + lll: + line-length: 140 + misspell: + locale: US + mnd: + checks: + - argument + - case + - condition + - operation + - return + - assign + nolintlint: + require-explanation: false + require-specific: false + allow-unused: false + wsl_v5: + allow-first-in-block: true + allow-whole-block: false + branch-max-lines: 2 + exclusions: + generated: lax + rules: + - linters: + - dupl + - funlen + - gocyclo + - gosec + path: _test\.go + - path: (.+)\.go$ + text: exported func * returns unexported type *, which can be annoying to use + - path: (.+)\.go$ + text: should have a package comment, unless it's in another file for this package + paths: + - \.pb\.go$ + - vendor/ + - third_party$ + - builtin$ + - examples$ issues: - # make issues output unique by line, default is true uniq-by-line: true - # Show only new issues: if there are unstaged changes or untracked files, - # only those changes are analyzed, else only changes in HEAD~ are analyzed. - # It's a super-useful option for integration of golangci-lint into existing - # large codebase. It's not practical to fix all existing issues at the moment - # of integration: much better don't allow issues in new code. - # Default is false. new: false - # Fix found issues (if it's supported by the linter) fix: false - exclude-files: - - \.pb\.go$ - exclude-dirs: - - vendor/ - exclude-use-default: false - exclude: - # for "public interface + private struct implementation" cases only! - - exported func * returns unexported type *, which can be annoying to use - - should have a package comment, unless it's in another file for this package - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - # Exclude some linters from running on tests files. - - path: _test\.go - linters: - - gocyclo - - funlen - - dupl - - gosec - -run: - issues-exit-code: 0 - tests: true - severity: - # Set the default severity for issues. - # - # If severity rules are defined and the issues do not match or no severity is provided to the rule - # this will be the default severity applied. - # Severities should match the supported severity names of the selected out format. - # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity - # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#SeverityLevel - # - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message - # - TeamCity: https://www.jetbrains.com/help/teamcity/service-messages.html#Inspection+Instance - # - # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...) - # - # Default: "" - default-severity: error - - # If set to true `severity-rules` regular expressions become case-sensitive. - # Default: false - case-sensitive: true - - # When a list of severity rules are provided, severity information will be added to lint issues. - # Severity rules have the same filtering capability as exclude rules - # except you are allowed to specify one matcher per severity rule. - # - # `@linter` can be used as severity value to keep the severity from linters (e.g. revive, gosec, ...) - # - # Only affects out formats that support setting severity information. - # - # Default: [] + default: error rules: - linters: - dupl severity: info - - -# output configuration options -output: - # colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions - # default is "colored-line-number" - formats: - - format: colored-line-number - path: stderr - - format: checkstyle - path: linters-report.xml - - - # Order to use when sorting results. - # Require `sort-results` to `true`. - # Possible values: `file`, `linter`, and `severity`. - # - # If the severity values are inside the following list, they are ordered in this order: - # 1. error - # 2. warning - # 3. high - # 4. medium - # 5. low - # Either they are sorted alphabetically. - # - # Default: ["file"] - sort-order: - - linter - - severity - - file # filepath, line, and column. - - # Show statistics per linter. - # Default: false - show-stats: true - - # print lines of code with issue, default is true - print-issued-lines: true - - # print linter name in the end of issue text, default is true - print-linter-name: true - - # add a prefix to the output file references; default is no prefix - path-prefix: "" - - # sorts results by: filepath, line and column - sort-results: true +formatters: + enable: + - gofmt + - goimports + settings: + gci: + sections: + - standard + - default + - prefix(github.com/obalunenko) + - localmodule + custom-order: true + no-lex-order: true + goimports: + local-prefixes: + - github.com/obalunenko/getenv + exclusions: + generated: lax + paths: + - \.pb\.go$ + - vendor/ + - third_party$ + - builtin$ + - examples$ diff --git a/vendor/github.com/obalunenko/getenv/Makefile b/vendor/github.com/obalunenko/getenv/Makefile index f281847..0cb5847 100644 --- a/vendor/github.com/obalunenko/getenv/Makefile +++ b/vendor/github.com/obalunenko/getenv/Makefile @@ -14,7 +14,7 @@ COMPOSE_TOOLS_CMD_BASE=docker compose -f $(COMPOSE_TOOLS_FILE) COMPOSE_TOOLS_CMD_UP=$(COMPOSE_TOOLS_CMD_BASE) up --exit-code-from COMPOSE_TOOLS_CMD_PULL=$(COMPOSE_TOOLS_CMD_BASE) pull -GOVERSION:=1.24 +GOVERSION:=1.26.2 TARGET_MAX_CHAR_NUM=20 diff --git a/vendor/github.com/obalunenko/getenv/README.md b/vendor/github.com/obalunenko/getenv/README.md index f6e83de..9c2fab5 100644 --- a/vendor/github.com/obalunenko/getenv/README.md +++ b/vendor/github.com/obalunenko/getenv/README.md @@ -9,6 +9,7 @@ Package getenv provides a simple way to get environment variables. It's type-safe and supports built-in types and slices of them. +Empty environment variable values are treated as not set. Types supported: - string diff --git a/vendor/github.com/obalunenko/getenv/getenv.go b/vendor/github.com/obalunenko/getenv/getenv.go index 0ca9ae8..9e3ac13 100644 --- a/vendor/github.com/obalunenko/getenv/getenv.go +++ b/vendor/github.com/obalunenko/getenv/getenv.go @@ -1,5 +1,6 @@ // Package getenv provides a simple way to get environment variables. // It's type-safe and supports built-in types and slices of them. +// Note: empty environment variable values are treated as "not set". // // Types supported: // - string @@ -77,6 +78,10 @@ func Env[T internal.EnvParsable](key string, options ...option.Option) (T, error return t, fmt.Errorf("failed to get environment variable[%s]: %w", key, ErrNotSet) } + if errors.Is(err, internal.ErrInvalidValue) { + return t, fmt.Errorf("failed to parse environment variable[%s]: %w", key, ErrInvalidValue) + } + return t, fmt.Errorf("failed to parse environment variable[%s]: %w", key, err) } diff --git a/vendor/github.com/obalunenko/getenv/internal/constraint.go b/vendor/github.com/obalunenko/getenv/internal/constraint.go index dace7b4..7e545fb 100644 --- a/vendor/github.com/obalunenko/getenv/internal/constraint.go +++ b/vendor/github.com/obalunenko/getenv/internal/constraint.go @@ -4,8 +4,6 @@ import ( "net" "net/url" "time" - - "golang.org/x/exp/constraints" ) type ( @@ -29,24 +27,30 @@ type ( IntSlice | FloatSlice | UintSlice } - // Int is a constraint for integer and slice of integers. - Int = constraints.Signed + // Int is a constraint for integer scalar types. + Int interface { + int | int8 | int16 | int32 | int64 + } // IntSlice is a constraint for slice of integers. IntSlice interface { []int | []int8 | []int16 | []int32 | []int64 } - // Uint is a constraint for unsigned integer and slice of unsigned integers. - Uint = constraints.Unsigned + // Uint is a constraint for unsigned integer scalar types. + Uint interface { + uint | uint8 | uint16 | uint32 | uint64 | uintptr + } // UintSlice is a constraint for slice of unsigned integers. UintSlice interface { []uint | []uint8 | []uint16 | []uint32 | []uint64 | []uintptr } - // Float is a constraint for float and slice of floats. - Float = constraints.Float + // Float is a constraint for floating-point scalar types. + Float interface { + float32 | float64 + } // FloatSlice is a constraint for slice of floats. FloatSlice interface { @@ -78,6 +82,8 @@ type ( []complex64 | []complex128 } - // Complex is a constraint for complex and slice of complex. - Complex = constraints.Complex + // Complex is a constraint for complex scalar types. + Complex interface { + complex64 | complex128 + } ) diff --git a/vendor/github.com/obalunenko/getenv/internal/iface.go b/vendor/github.com/obalunenko/getenv/internal/iface.go index cd09539..c8fa999 100644 --- a/vendor/github.com/obalunenko/getenv/internal/iface.go +++ b/vendor/github.com/obalunenko/getenv/internal/iface.go @@ -48,11 +48,11 @@ func newComplexParser(v any) EnvParser { case complex64: return complexParser[complex64]{} case []complex64: - return complexSliceParser[[]complex64, complex64]{} + return complexSliceParser[complex64]{} case complex128: return complexParser[complex128]{} case []complex128: - return complexSliceParser[[]complex128, complex128]{} + return complexSliceParser[complex128]{} default: return nil } @@ -99,23 +99,23 @@ func newIntParser(v any) EnvParser { case int: return numberParser[int]{} case []int: - return numberSliceParser[[]int, int]{} + return numberSliceParser[int]{} case int8: return numberParser[int8]{} case []int8: - return numberSliceParser[[]int8, int8]{} + return numberSliceParser[int8]{} case int16: return numberParser[int16]{} case []int16: - return numberSliceParser[[]int16, int16]{} + return numberSliceParser[int16]{} case int32: return numberParser[int32]{} case []int32: - return numberSliceParser[[]int32, int32]{} + return numberSliceParser[int32]{} case int64: return numberParser[int64]{} case []int64: - return numberSliceParser[[]int64, int64]{} + return numberSliceParser[int64]{} default: return nil } @@ -127,27 +127,27 @@ func newUintParser(v any) EnvParser { case uint8: return numberParser[uint8]{} case []uint8: - return numberSliceParser[[]uint8, uint8]{} + return numberSliceParser[uint8]{} case uint: return numberParser[uint]{} case []uint: - return numberSliceParser[[]uint, uint]{} + return numberSliceParser[uint]{} case uint16: return numberParser[uint16]{} case []uint16: - return numberSliceParser[[]uint16, uint16]{} + return numberSliceParser[uint16]{} case uint32: return numberParser[uint32]{} case []uint32: - return numberSliceParser[[]uint32, uint32]{} + return numberSliceParser[uint32]{} case uint64: return numberParser[uint64]{} case []uint64: - return numberSliceParser[[]uint64, uint64]{} + return numberSliceParser[uint64]{} case uintptr: return numberParser[uintptr]{} case []uintptr: - return numberSliceParser[[]uintptr, uintptr]{} + return numberSliceParser[uintptr]{} default: return nil } @@ -159,11 +159,11 @@ func newFloatParser(v any) EnvParser { case float32: return numberParser[float32]{} case []float32: - return numberSliceParser[[]float32, float32]{} + return numberSliceParser[float32]{} case float64: return numberParser[float64]{} case []float64: - return numberSliceParser[[]float64, float64]{} + return numberSliceParser[float64]{} default: return nil } @@ -224,12 +224,12 @@ func (n numberParser[T]) ParseEnv(key string, _ Parameters) (any, error) { return getNumberGen[T](key) } -type numberSliceParser[S []T, T Number] struct{} +type numberSliceParser[T Number] struct{} -func (i numberSliceParser[S, T]) ParseEnv(key string, options Parameters) (any, error) { +func (i numberSliceParser[T]) ParseEnv(key string, options Parameters) (any, error) { sep := options.Separator - return getNumberSliceGen[S, T](key, sep) + return getNumberSliceGen[T](key, sep) } type boolParser bool @@ -316,10 +316,10 @@ func (n complexParser[T]) ParseEnv(key string, _ Parameters) (any, error) { return getComplexGen[T](key) } -type complexSliceParser[S []T, T Complex] struct{} +type complexSliceParser[T Complex] struct{} -func (i complexSliceParser[S, T]) ParseEnv(key string, options Parameters) (any, error) { +func (i complexSliceParser[T]) ParseEnv(key string, options Parameters) (any, error) { sep := options.Separator - return getComplexSliceGen[S, T](key, sep) + return getComplexSliceGen[T](key, sep) } diff --git a/vendor/github.com/obalunenko/getenv/internal/parsers.go b/vendor/github.com/obalunenko/getenv/internal/parsers.go index e362b60..0cf153e 100644 --- a/vendor/github.com/obalunenko/getenv/internal/parsers.go +++ b/vendor/github.com/obalunenko/getenv/internal/parsers.go @@ -5,12 +5,20 @@ import ( "net" "net/url" "os" - "reflect" "strconv" "strings" "time" ) +const ( + decimalBase = 10 + bitSize8 = 8 + bitSize16 = 16 + bitSize32 = 32 + bitSize64 = 64 + bitSize128 = 128 +) + func getString(key string) (string, error) { env, ok := os.LookupEnv(key) if !ok || env == "" { @@ -76,65 +84,82 @@ func getStringSlice(key, sep string) ([]string, error) { } func parseNumberGen[T Number](raw string) (T, error) { - var tt T - - const ( - base = 10 - ) + var zero T + + switch any(zero).(type) { + case int: + return parseSignedNumber[T](raw, decimalBase, strconv.IntSize) + case int8: + return parseSignedNumber[T](raw, decimalBase, bitSize8) + case int16: + return parseSignedNumber[T](raw, decimalBase, bitSize16) + case int32: + return parseSignedNumber[T](raw, decimalBase, bitSize32) + case int64: + return parseSignedNumber[T](raw, decimalBase, bitSize64) + case uint: + return parseUnsignedNumber[T](raw, decimalBase, strconv.IntSize) + case uint8: + return parseUnsignedNumber[T](raw, decimalBase, bitSize8) + case uint16: + return parseUnsignedNumber[T](raw, decimalBase, bitSize16) + case uint32: + return parseUnsignedNumber[T](raw, decimalBase, bitSize32) + case uint64: + return parseUnsignedNumber[T](raw, decimalBase, bitSize64) + case uintptr: + return parseUnsignedNumber[T](raw, decimalBase, strconv.IntSize) + case float32: + return parseFloatNumber[T](raw, bitSize32) + case float64: + return parseFloatNumber[T](raw, bitSize64) + default: + return zero, ErrInvalidValue + } +} - rt := reflect.TypeOf(tt) +func parseSignedNumber[T Number](raw string, base, bits int) (T, error) { + var zero T - switch rt.Kind() { //nolint:exhaustive // All supported types are covered. - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - val, err := strconv.ParseInt(raw, base, rt.Bits()) - if err != nil { - return tt, ErrInvalidValue - } + val, err := strconv.ParseInt(raw, base, bits) + if err != nil { + return zero, ErrInvalidValue + } - res, ok := any(T(val)).(T) - if !ok { - return tt, ErrInvalidValue - } + return T(val), nil +} - return res, nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - val, err := strconv.ParseUint(raw, base, rt.Bits()) - if err != nil { - return tt, ErrInvalidValue - } +func parseUnsignedNumber[T Number](raw string, base, bits int) (T, error) { + var zero T - res, ok := any(T(val)).(T) - if !ok { - return tt, ErrInvalidValue - } + val, err := strconv.ParseUint(raw, base, bits) + if err != nil { + return zero, ErrInvalidValue + } - return res, nil - case reflect.Float32, reflect.Float64: - val, err := strconv.ParseFloat(raw, rt.Bits()) - if err != nil { - return tt, ErrInvalidValue - } + return T(val), nil +} - res, ok := any(T(val)).(T) - if !ok { - return tt, ErrInvalidValue - } +func parseFloatNumber[T Number](raw string, bits int) (T, error) { + var zero T - return res, nil - default: - return tt, ErrInvalidValue + val, err := strconv.ParseFloat(raw, bits) + if err != nil { + return zero, ErrInvalidValue } + + return T(val), nil } -func parseNumberSliceGen[S []T, T Number](raw []string) (S, error) { - var tt S +func parseNumberSliceGen[T Number](raw []string) ([]T, error) { + var zero []T - val := make(S, 0, len(raw)) + val := make([]T, 0, len(raw)) for _, s := range raw { v, err := parseNumberGen[T](s) if err != nil { - return tt, err + return zero, err } val = append(val, v) @@ -143,13 +168,13 @@ func parseNumberSliceGen[S []T, T Number](raw []string) (S, error) { return val, nil } -func getNumberSliceGen[S []T, T Number](key, sep string) (S, error) { +func getNumberSliceGen[T Number](key, sep string) ([]T, error) { env, err := getStringSlice(key, sep) if err != nil { return nil, err } - return parseNumberSliceGen[S, T](env) + return parseNumberSliceGen[T](env) } func getNumberGen[T Number](key string) (T, error) { @@ -298,39 +323,38 @@ func getIPSlice(key, sep string) ([]net.IP, error) { } func parseComplexGen[T Complex](raw string) (T, error) { - var tt T - - var bitsize int - - switch any(tt).(type) { - case complex64: - bitsize = 64 - case complex128: - bitsize = 128 - } + var zero T - val, err := strconv.ParseComplex(raw, bitsize) + val, err := strconv.ParseComplex(raw, complexBits[T]()) if err != nil { - return tt, newErrInvalidValue(err.Error()) + return zero, newErrInvalidValue(err.Error()) } - res, ok := any(T(val)).(T) - if !ok { - return tt, ErrInvalidValue - } + return T(val), nil +} + +func complexBits[T Complex]() int { + var zero T - return res, nil + switch any(zero).(type) { + case complex64: + return bitSize64 + case complex128: + return bitSize128 + default: + return 0 + } } -func parseComplexSliceGen[S []T, T Complex](raw []string) (S, error) { - var tt S +func parseComplexSliceGen[T Complex](raw []string) ([]T, error) { + var zero []T - val := make(S, 0, len(raw)) + val := make([]T, 0, len(raw)) for _, s := range raw { v, err := parseComplexGen[T](s) if err != nil { - return tt, err + return zero, err } val = append(val, v) @@ -339,13 +363,13 @@ func parseComplexSliceGen[S []T, T Complex](raw []string) (S, error) { return val, nil } -func getComplexSliceGen[S []T, T Complex](key, sep string) (S, error) { +func getComplexSliceGen[T Complex](key, sep string) ([]T, error) { env, err := getStringSlice(key, sep) if err != nil { return nil, err } - return parseComplexSliceGen[S, T](env) + return parseComplexSliceGen[T](env) } func getComplexGen[T Complex](key string) (T, error) { diff --git a/vendor/github.com/obalunenko/getenv/linters-report.xml b/vendor/github.com/obalunenko/getenv/linters-report.xml deleted file mode 100644 index fd4ea08..0000000 --- a/vendor/github.com/obalunenko/getenv/linters-report.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/vendor/golang.org/x/exp/LICENSE b/vendor/golang.org/x/exp/LICENSE deleted file mode 100644 index 2a7cf70..0000000 --- a/vendor/golang.org/x/exp/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2009 The Go Authors. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google LLC nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/exp/PATENTS b/vendor/golang.org/x/exp/PATENTS deleted file mode 100644 index 7330990..0000000 --- a/vendor/golang.org/x/exp/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/exp/constraints/constraints.go b/vendor/golang.org/x/exp/constraints/constraints.go deleted file mode 100644 index a9392af..0000000 --- a/vendor/golang.org/x/exp/constraints/constraints.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package constraints defines a set of useful constraints to be used -// with type parameters. -package constraints - -// Signed is a constraint that permits any signed integer type. -// If future releases of Go add new predeclared signed integer types, -// this constraint will be modified to include them. -type Signed interface { - ~int | ~int8 | ~int16 | ~int32 | ~int64 -} - -// Unsigned is a constraint that permits any unsigned integer type. -// If future releases of Go add new predeclared unsigned integer types, -// this constraint will be modified to include them. -type Unsigned interface { - ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr -} - -// Integer is a constraint that permits any integer type. -// If future releases of Go add new predeclared integer types, -// this constraint will be modified to include them. -type Integer interface { - Signed | Unsigned -} - -// Float is a constraint that permits any floating-point type. -// If future releases of Go add new predeclared floating-point types, -// this constraint will be modified to include them. -type Float interface { - ~float32 | ~float64 -} - -// Complex is a constraint that permits any complex numeric type. -// If future releases of Go add new predeclared complex numeric types, -// this constraint will be modified to include them. -type Complex interface { - ~complex64 | ~complex128 -} - -// Ordered is a constraint that permits any ordered type: any type -// that supports the operators < <= >= >. -// If future releases of Go add new ordered types, -// this constraint will be modified to include them. -// -// This type is redundant since Go 1.21 introduced [cmp.Ordered]. -type Ordered interface { - Integer | Float | ~string -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 3d970e6..e31e95b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -100,8 +100,8 @@ github.com/go-viper/mapstructure/v2/internal/errors # github.com/google/uuid v1.6.0 ## explicit github.com/google/uuid -# github.com/obalunenko/getenv v1.14.1 -## explicit; go 1.24 +# github.com/obalunenko/getenv v1.14.2 +## explicit; go 1.26.2 github.com/obalunenko/getenv github.com/obalunenko/getenv/internal github.com/obalunenko/getenv/option @@ -147,9 +147,6 @@ go.opentelemetry.io/otel/trace/noop # go.yaml.in/yaml/v3 v3.0.4 ## explicit; go 1.16 go.yaml.in/yaml/v3 -# golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa -## explicit; go 1.23.0 -golang.org/x/exp/constraints # golang.org/x/net v0.52.0 ## explicit; go 1.25.0 golang.org/x/net/idna