Skip to content

feat: Updates Go to 1.26 and refactors internal parsing#193

Merged
obalunenko merged 6 commits intomasterfrom
develop
Apr 15, 2026
Merged

feat: Updates Go to 1.26 and refactors internal parsing#193
obalunenko merged 6 commits intomasterfrom
develop

Conversation

@obalunenko
Copy link
Copy Markdown
Owner

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 for ErrInvalidValue to prevent panics and provide clearer error messages. The stretchr/testify testing library is updated, and the golang.org/x/exp/constraints dependency 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/testify might also bring subtle behavioral changes to assertions.

Other notes

  • Go version 1.26.2 is now used across all GitHub Actions workflows, Makefile configuration, and Docker build environments.
  • The build/docker/go-tools/Dockerfile base image is updated to v1.10.0.
  • The .gitignore file now includes .vscode/ to ignore VS Code specific files.
  • The README.md and getenv.go documentation clarify that empty environment variable values are treated as "not set".
  • The getenv_example_test.go for url.URL now uses urlVal.String() for canonical output.
  • The scripts/bump-go.sh script has been refactored for better maintainability and robustness in handling Go version updates.

Copilot AI review requested due to automatic review settings April 14, 2026 22:53
@obalunenko obalunenko self-assigned this Apr 14, 2026
@github-advanced-security
Copy link
Copy Markdown

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:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 refactor scripts/bump-go.sh.
  • Refactor internal numeric/complex parsing and slice parsing to use explicit generic helpers (no reflect) and adjust related tests.
  • Update stretchr/testify vendoring and remove golang.org/x/exp/constraints in 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.

Comment thread go.mod
Comment thread internal/constraint.go Outdated
Comment thread scripts/bump-go.sh Outdated
@sonarqubecloud
Copy link
Copy Markdown

@obalunenko obalunenko requested a review from Copilot April 15, 2026 19:39
@obalunenko obalunenko merged commit 66b69f3 into master Apr 15, 2026
19 of 22 checks passed
@obalunenko obalunenko deleted the develop branch April 15, 2026 19:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread go.mod
Comment on lines +3 to 4
go 1.26.2

Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
go 1.26.2
go 1.26
toolchain go1.26.2

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants