feat: Updates Go to 1.26 and refactors internal parsing#193
feat: Updates Go to 1.26 and refactors internal parsing#193obalunenko merged 6 commits intomasterfrom
Conversation
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
There was a problem hiding this comment.
Pull request overview
Updates the project’s Go toolchain version and refactors internal env parsing to remove reflection-based logic, while also refreshing vendored dependencies and tightening error sentinel behavior/documentation.
Changes:
- Bump Go version references across
go.mod, CI workflows, Makefile, and build Dockerfile, and refactorscripts/bump-go.sh. - Refactor internal numeric/complex parsing and slice parsing to use explicit generic helpers (no
reflect) and adjust related tests. - Update
stretchr/testifyvendoring and removegolang.org/x/exp/constraintsin favor of local constraint definitions; update docs/examples accordingly.
Reviewed changes
Copilot reviewed 17 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vendor/modules.txt | Updates vendored module list (testify bump; removes x/exp). |
| vendor/golang.org/x/exp/constraints/constraints.go | Removes vendored constraints package. |
| vendor/golang.org/x/exp/PATENTS | Removes x/exp vendored patent notice (module removed). |
| vendor/golang.org/x/exp/LICENSE | Removes x/exp vendored license (module removed). |
| vendor/github.com/stretchr/testify/require/require_forward.go | Vendored testify updates (API/docs/forwarders). |
| vendor/github.com/stretchr/testify/require/require.go | Vendored testify updates (adds IsNotType; doc tweaks). |
| vendor/github.com/stretchr/testify/require/doc.go | Vendored testify doc update (goroutine usage note). |
| vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go | Vendored testify build tag cleanup. |
| vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go | Vendored testify build tag cleanup. |
| vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go | Vendored testify build tag cleanup. |
| vendor/github.com/stretchr/testify/assert/http_assertions.go | Improves assertion error message quoting in vendored testify. |
| vendor/github.com/stretchr/testify/assert/doc.go | Adds brief package note in vendored testify docs. |
| vendor/github.com/stretchr/testify/assert/assertions.go | Vendored testify logic/doc updates (CallerInfo, Empty, JSONEq/YAMLEq shortcuts, error-chain formatting, etc.). |
| vendor/github.com/stretchr/testify/assert/assertion_order.go | Improves type formatting in vendored testify order assertions. |
| vendor/github.com/stretchr/testify/assert/assertion_forward.go | Vendored testify forwarder updates (Empty/NotEmpty/Type assertions). |
| vendor/github.com/stretchr/testify/assert/assertion_format.go | Vendored testify formatted assertion updates (Emptyf/IsNotTypef, etc.). |
| vendor/github.com/stretchr/testify/assert/assertion_compare.go | Vendored testify compare assertion message formatting refactor. |
| scripts/bump-go.sh | Refactors Go bump script for robustness (normalization/escaping/toolchain handling). |
| internal/parsers_test.go | Updates tests/benchmarks to new generic slice parser signatures. |
| internal/parsers.go | Removes reflection-based numeric parsing; introduces explicit parsing helpers and simpler generic slice parsing. |
| internal/iface_test.go | Updates parser type expectations to new generic parser types. |
| internal/iface.go | Updates parser implementations to align with new generic slice parsing APIs. |
| internal/constraint.go | Removes dependency on x/exp/constraints; defines local constraints. |
| internal/common_test.go | Strengthens error assertions (uses any and adds ErrorIs checks). |
| go.sum | Updates sums for testify bump; removes x/exp sums. |
| go.mod | Updates Go version and dependencies (testify bump; removes x/exp). |
| getenv_test.go | Adds error sentinel coverage test; improves helper to assert ErrorIs. |
| getenv_example_test.go | Makes URL example output canonical via url.URL.String(). |
| getenv.go | Maps internal invalid-value errors to exported sentinel for clearer API behavior. |
| build/docker/go-tools/Dockerfile | Bumps go-tools base image version. |
| README.md | Clarifies empty env var values are treated as “not set”. |
| Makefile | Updates Go version used by tooling targets. |
| .gitignore | Ignores .vscode/. |
| .github/workflows/release.yml | Pins CI Go version to 1.26.2 for release workflow. |
| .github/workflows/go.yml | Pins CI Go version to 1.26.2 across build/test/lint/report jobs. |
| .github/workflows/codeql-analysis.yml | Pins CodeQL workflow Go version to 1.26.2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 39 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| go 1.26.2 | ||
|
|
There was a problem hiding this comment.
The go directive is now set to a specific patch version (1.26.2) and the toolchain directive was removed. In this repo the go directive previously tracked the language version (major.minor) while toolchain pinned the patch release; keeping that split avoids implying language semantics change across patch releases and aligns with Go's intended use of these directives. Consider setting go to 1.26 (or 1.26.0) and adding back toolchain go1.26.2 if you want to pin the exact toolchain version.
| go 1.26.2 | |
| go 1.26 | |
| toolchain go1.26.2 |



Description
This change updates the project's Go version to 1.26.2 and refactors internal environment variable parsing logic. It eliminates the use of reflection in
internal/parsers.go, transitioning to a more explicit and performant approach using Go's generics. Error handling is also improved by adding specific checks forErrInvalidValueto prevent panics and provide clearer error messages. Thestretchr/testifytesting library is updated, and thegolang.org/x/exp/constraintsdependency is removed by defining constraints directly.Github Issue
If any, add a Github issue number.
Possible failures/side-effects
The core parsing logic has been refactored to remove reflection. While new tests specifically verify error sentinels and existing tests continue to pass, fundamental changes in type parsing could introduce unforeseen edge cases. The update to
stretchr/testifymight also bring subtle behavioral changes to assertions.Other notes
Makefileconfiguration, and Docker build environments.build/docker/go-tools/Dockerfilebase image is updated tov1.10.0..gitignorefile now includes.vscode/to ignore VS Code specific files.README.mdandgetenv.godocumentation clarify that empty environment variable values are treated as "not set".getenv_example_test.goforurl.URLnow usesurlVal.String()for canonical output.scripts/bump-go.shscript has been refactored for better maintainability and robustness in handling Go version updates.