Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ runs:
run: docker exec
--env GITHUB_TOKEN
--env HOMEBREW_DEPLOY_KEY
--env GOTOOLCHAIN=auto
--workdir "$PWD"
--tty
"$CONTAINER_ID"
Expand Down
30 changes: 30 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# golangci-lint v2 config reproducing the v1 defaults this repo linted with
# before the Go 1.26 bump (golangci-lint v1 cannot read Go 1.26 export data).
# Generated with `golangci-lint migrate` from an empty v1 config.
version: "2"
linters:
settings:
staticcheck:
# v1 ran staticcheck (SA) and gosimple (S1) by default; v2 merges
# stylecheck (ST) and quickfix (QF) into staticcheck. Keep the v1 set.
checks:
- "SA*"
- "S1*"
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
6 changes: 6 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ builds:
# The real values are defined by the CC_<OS>_<ARCH> env vars defined at the top `env` attribute.
- 'CC={{ index .Env (print "CC_" .Os "_" .Arch) }}'
- 'CXX={{ index .Env (print "CXX_" .Os "_" .Arch) }}'
hooks:
post:
# Refuse to ship a binary built with an older Go than go.mod's toolchain
# directive (INC-289: Go 1.26.10 distrusts compromised eMudhra CAs).
- cmd: ./scripts/check-go-toolchain.sh "{{ .Path }}"
output: true

dockers:
# AMD64
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Cache bust: force rebuild for Go 1.26.0 compatibility
# Cache bust: golangci-lint v2.9.0 for Go 1.26.10
repos:
- repo: https://github.com/golangci/golangci-lint
rev: v1.63.4
rev: v2.9.0
hooks:
- id: golangci-lint
entry: golangci-lint run
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ Installed via `make install-hooks`. Checks:

## Linting

- Go: `golangci-lint` (v1.63.4) via pre-commit
- Go: `golangci-lint` (v2.9.0) via pre-commit
- Frontend: ESLint + Prettier
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/launchdarkly/ldcli

go 1.25.0

toolchain go1.26.10

require (
github.com/adrg/frontmatter v0.2.0
github.com/adrg/xdg v0.5.3
Expand Down
21 changes: 21 additions & 0 deletions scripts/check-go-toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Fails the build if a binary was not compiled with the toolchain pinned in
# go.mod. Run by goreleaser as a post-build hook, so a release built with an
# older Go (e.g. one missing crypto/x509 security fixes) never gets published.
set -euo pipefail

binary="$1"
want="$(awk '$1 == "toolchain" { print $2 }' go.mod)"
got="$(go version "$binary" | awk '{ print $NF }')"

if [ -z "$want" ]; then
echo "check-go-toolchain: no toolchain directive in go.mod" >&2
exit 1
fi

if [ "$got" != "$want" ]; then
echo "check-go-toolchain: $binary was built with $got, go.mod pins $want" >&2
exit 1
fi

echo "check-go-toolchain: $binary built with $got"
Loading