Skip to content

chore: upgrade to Go 1.27.1 - #338

Merged
eberle1080 merged 2 commits into
mainfrom
chore/go-127-upgrade
Sep 11, 2026
Merged

eberle1080 merged 2 commits into
mainfrom
chore/go-127-upgrade

Conversation

@eberle1080

@eberle1080 eberle1080 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What

Bumps the Go toolchain from 1.26.4 to 1.27.1, and golangci-lint from v2.9.0 to v2.13.2 to go with it.

Commits

1. chore: upgrade to Go 1.27.1 — the go directive in go.mod. go mod tidy also consolidated the two indirect require (...) blocks into one; no dependency versions changed and go.sum is untouched.

Nothing else pins a Go version: both workflows resolve the toolchain via actions/setup-go with go-version-file: go.mod, the Dockerfile is an alpine runtime image that copies a prebuilt binary, and .goreleaser.yaml uses the ambient toolchain.

2. ci: upgrade golangci-lint to v2.13.2 — required by the bump. v2.9.0 refuses to run against a 1.27 target:

can't load config: the Go language version (go1.26) used to build golangci-lint
is lower than the targeted Go version (1.27.1)

v2.13.0 is the first release whose binaries are built with Go 1.27 (checked with go version -m; v2.12.2 is still go1.26.2). This pins v2.13.2.

Lint findings the newer linter surfaced

v2.13.2 runs checks v2.9.0 never did — 61 findings on previously-green code:

Count Linter Resolution
50 exhaustruct_v5 Config, not debt — see below
3 goconst Extracted constants
3 staticcheck QF1012 fmt.Fprintf(&b, ...) over b.WriteString(fmt.Sprintf(...))
1 modernize errors.AsType[*json.SyntaxError] over errors.As
1 gosec G124 Set SameSite on the Clerk session cookie
3 gosec taint Annotated with justification — see below

The 50 exhaustruct_v5 findings are not new debt: exhaustruct was deprecated and renamed, so the existing disable entry stopped matching and an already-rejected linter came back on. Both names are now disabled, following the wsl/wsl_v5 precedent already in this config. gomodguardgomodguard_v2 got the same treatment (it was only emitting a deprecation warning).

Reviewer attention: three suppressed gosec findings

These are taint-analysis results with no real fix available. Each carries its reasoning inline:

  • G705 XSS (cmd/login.go) — the response is mustache-rendered and the only interpolation is {{email}}, the escaping form. Verified empirically by rendering a <script>alert(1)</script> payload through clerk.getHTML: it comes back as &lt;script&gt;.
  • G703 path traversal (cmd/login.go) — the write target is the user's own XDG config path; the only caller-influenced part is AMP_STAGE_OVERRIDE, an env var they set for themselves.
  • G702 command injection (cmd/trigger.go) — the user's own $EDITOR, run locally as themselves. This line already carried an equivalent nosemgrep justification from Fix build: Go 1.26, golangci-lint v2, dependency and CI updates #312.

Verification

Against the official golangci-lint v2.13.2 binary: 0 issues, no deprecation warnings. go build, go vet, go test, gofmt all clean. task build succeeds and ./bin/amp version reports go version: go1.27.1.

🤖 Generated with Claude Code

eberle1080 and others added 2 commits September 11, 2026 11:23
Bump the go directive from 1.26.4 to 1.27.1 and run `go mod tidy`,
which consolidated the two indirect require blocks into one. No
dependency versions changed and go.sum is untouched.

Both CI workflows resolve their toolchain via
`setup-go: go-version-file: go.mod`, so no workflow changes are
needed. The Dockerfile is an alpine runtime image that copies a
prebuilt binary, and nothing else in the repo pins a Go version.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
golangci-lint v2.9.0 refuses to run against a module targeting Go
1.27.1: "the Go language version (go1.26) used to build golangci-lint
is lower than the targeted Go version (1.27.1)". v2.13.0 is the first
release whose binaries are built with Go 1.27; this pins v2.13.2.

The newer linter surfaces findings v2.9.0 never ran:

- exhaustruct is deprecated in favor of exhaustruct_v5, so the existing
  disable entry no longer matched and the linter came back on (50
  findings). Disable both names, following the wsl/wsl_v5 precedent
  already in this config. Same for gomodguard -> gomodguard_v2, which
  was only emitting a deprecation warning.
- goconst: extract headerContentType/mimeApplicationJSON in request and
  objAccounts/objContacts in the manifest test.
- staticcheck QF1012: fmt.Fprintf(&b, ...) over b.WriteString(fmt.Sprintf(...)).
- modernize: errors.AsType[*json.SyntaxError] over errors.As.
- gosec G124: set SameSite on the Clerk session cookie.

Three gosec taint-analysis findings are annotated rather than changed,
each with the reason inline:

- G705 (login.go): the response is mustache-rendered and the sole
  interpolation is {{email}}, the escaping form. Verified by rendering
  a <script> payload through clerk.getHTML — it comes back as
  &lt;script&gt;.
- G703 (login.go): the write target is the user's own XDG config path;
  the only caller-influenced part is AMP_STAGE_OVERRIDE, their own env var.
- G702 (trigger.go): the user's own $EDITOR, run locally as themselves.
  This line already carried an equivalent nosemgrep justification.

Verified against the official golangci-lint v2.13.2 binary: 0 issues,
no deprecation warnings. go build, go vet and go test all clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@eberle1080
eberle1080 requested review from a team and jlimatampersand and removed request for a team September 11, 2026 18:36
@eberle1080
eberle1080 merged commit 3354468 into main Sep 11, 2026
4 checks passed
@eberle1080
eberle1080 deleted the chore/go-127-upgrade branch September 11, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants