From e21d76ad2e6659ca688c3421a7ab5fbbc0c22df4 Mon Sep 17 00:00:00 2001 From: William Bezuidenhout Date: Mon, 10 Nov 2025 17:03:42 +0200 Subject: [PATCH 1/6] go 1.25 + upgrade containers --- .tool-versions | 2 +- Dockerfile | 4 ++-- go.mod | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.tool-versions b/.tool-versions index e21aa83dff..2dc1382b79 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -golang 1.24.1 +golang 1.25.4 shfmt 3.8.0 shellcheck 0.10.0 diff --git a/Dockerfile b/Dockerfile index c039cc485f..91128f4ec5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,14 +4,14 @@ # # Nothing fancy here: we copy in the source code and build on the Alpine Go # image. Refer to .dockerignore to get a sense of what we're not going to copy. -FROM golang:1.24.1-alpine@sha256:43c094ad24b6ac0546c62193baeb3e6e49ce14d3250845d166c77c25f64b0386 AS builder +FROM golang:1.25.2-alpine@sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb AS builder COPY . /src WORKDIR /src RUN go build ./cmd/src # This stage should be kept in sync with Dockerfile.release. -FROM alpine:3.22@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 +FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 # needed for `src code-intel upload` and `src actions exec` RUN apk add --no-cache git diff --git a/go.mod b/go.mod index 6c581211e3..ac72a87347 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/sourcegraph/src-cli -go 1.24 - -toolchain go1.24.1 +go 1.25 require ( cloud.google.com/go/storage v1.30.1 @@ -19,7 +17,6 @@ require ( github.com/dustin/go-humanize v1.0.1 github.com/gobwas/glob v0.2.3 github.com/google/go-cmp v0.6.0 - github.com/gorilla/websocket v1.5.3 github.com/grafana/regexp v0.0.0-20221123153739-15dc172cd2db github.com/hexops/autogold v1.3.1 github.com/jedib0t/go-pretty/v6 v6.3.7 @@ -51,6 +48,7 @@ require ( github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/s2a-go v0.1.4 // indirect + github.com/gorilla/websocket v1.5.3 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.14.3 // indirect github.com/jackc/pgio v1.0.0 // indirect From 5365859bbb035a83e27a429a937a5d66bd6a43a9 Mon Sep 17 00:00:00 2001 From: William Bezuidenhout Date: Mon, 10 Nov 2025 17:07:07 +0200 Subject: [PATCH 2/6] update workflows --- .github/workflows/go-ci.yml | 2 +- .github/workflows/go-lint.yml | 2 +- .github/workflows/goreleaser-check.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go-ci.yml b/.github/workflows/go-ci.yml index 33dce1f948..0d3acea806 100644 --- a/.github/workflows/go-ci.yml +++ b/.github/workflows/go-ci.yml @@ -11,7 +11,7 @@ jobs: go-test: strategy: matrix: - go-version: [1.24.1] + go-version: ['1.25'] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml index 3343e9ae8c..7c99b5999f 100644 --- a/.github/workflows/go-lint.yml +++ b/.github/workflows/go-lint.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.24.1 + go-version: '1.25' - name: Enable pulling Go modules from private sourcegraph/sourcegraph run: git config --global url."https://${PRIVATE_TOKEN}@github.com/sourcegraph/".insteadOf "https://github.com/sourcegraph/" - run: ./dev/go-lint.sh diff --git a/.github/workflows/goreleaser-check.yml b/.github/workflows/goreleaser-check.yml index 8ff2f3b5c9..45d5c46e47 100644 --- a/.github/workflows/goreleaser-check.yml +++ b/.github/workflows/goreleaser-check.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.24.1 + go-version: '1.25' - name: Enable pulling Go modules from private sourcegraph/sourcegraph run: git config --global url."https://${PRIVATE_TOKEN}@github.com/sourcegraph/".insteadOf "https://github.com/sourcegraph/" - name: Check GoReleaser config From be7c871779e12045e1e20ecf78baea3a03cc2fbb Mon Sep 17 00:00:00 2001 From: William Bezuidenhout Date: Mon, 10 Nov 2025 17:11:02 +0200 Subject: [PATCH 3/6] use golangci-lint 2.6.1 --- dev/golangci-lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/golangci-lint.sh b/dev/golangci-lint.sh index c4663dc8ec..dffeb31b2f 100755 --- a/dev/golangci-lint.sh +++ b/dev/golangci-lint.sh @@ -6,7 +6,7 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null mkdir -p dev/.bin -version="1.64.5" +version="2.6.1" suffix="${version}-$(go env GOOS)-$(go env GOARCH)" target="$PWD/dev/.bin/golangci-lint-${suffix}" url="https://github.com/golangci/golangci-lint/releases/download/v${version}/golangci-lint-${suffix}.tar.gz" From 28417165a889cab36cd1dc8b216b1aa4547a6d84 Mon Sep 17 00:00:00 2001 From: William Bezuidenhout Date: Mon, 10 Nov 2025 17:15:00 +0200 Subject: [PATCH 4/6] migrate golangci-lint to v2 --- .golangci.yml | 102 +++++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 47 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 961158d5e1..39e52917b9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,59 +1,67 @@ -# See explanation of linters at https://golangci-lint.run/usage/linters/ +version: "2" linters: - disable-all: true + default: none enable: - bodyclose - depguard - gocritic - - goimports - - gosimple - govet - ineffassign - nolintlint - staticcheck - - typecheck - unconvert - unused - -linters-settings: - depguard: + settings: + depguard: + rules: + main: + deny: + - pkg: errors + desc: Use github.com/sourcegraph/sourcegraph/lib/errors instead + - pkg: github.com/pkg/errors + desc: Use github.com/sourcegraph/sourcegraph/lib/errors instead + - pkg: github.com/cockroachdb/errors + desc: Use github.com/sourcegraph/sourcegraph/lib/errors instead + - pkg: github.com/hashicorp/go-multierror + desc: Use github.com/sourcegraph/sourcegraph/lib/errors instead + - pkg: io/ioutil + desc: The ioutil package has been deprecated + forbidigo: + forbid: + - pattern: fmt\.Errorf + gocritic: + disabled-checks: + - appendAssign + - assignOp + - commentFormatting + - deprecatedComment + - exitAfterDefer + - ifElseChain + - singleCaseSwitch + govet: + disable: + - composites + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling rules: - main: - deny: - - pkg: "errors" - desc: "Use github.com/sourcegraph/sourcegraph/lib/errors instead" - - pkg: "github.com/pkg/errors" - desc: "Use github.com/sourcegraph/sourcegraph/lib/errors instead" - - pkg: "github.com/cockroachdb/errors" - desc: "Use github.com/sourcegraph/sourcegraph/lib/errors instead" - - pkg: "github.com/hashicorp/go-multierror" - desc: "Use github.com/sourcegraph/sourcegraph/lib/errors instead" - - pkg: "io/ioutil" - desc: "The ioutil package has been deprecated" - gocritic: - disabled-checks: - - appendAssign # Too many false positives - - assignOp # Maybe worth adding, but likely not worth the noise - - commentFormatting # No strong benefit - - deprecatedComment # Unnecessary - - exitAfterDefer # Only occurs in auxiliary tools - - ifElseChain # Noisy for not much gain - - singleCaseSwitch # Noisy for not much gain - govet: - disable: - - composites - forbidigo: - forbid: - # Use errors.New instead - - 'fmt\.Errorf' - -issues: - exclude-rules: - # Exclude bodyclose lint from tests because leaking connections in tests - # is a non-issue, and checking that adds unnecessary noise - - path: _test\.go - linters: - - bodyclose - -run: - timeout: 5m + - linters: + - bodyclose + path: _test\.go + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ From 3c5eb53cb31093cd315727b8a3ee4e074fdee0be Mon Sep 17 00:00:00 2001 From: William Bezuidenhout Date: Mon, 10 Nov 2025 17:32:45 +0200 Subject: [PATCH 5/6] fix golang container tag --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 91128f4ec5..a3c6ff8fb7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ # # Nothing fancy here: we copy in the source code and build on the Alpine Go # image. Refer to .dockerignore to get a sense of what we're not going to copy. -FROM golang:1.25.2-alpine@sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb AS builder +FROM golang:1.25.4-alpine3.22@sha256:d3f0cf7723f3429e3f9ed846243970b20a2de7bae6a5b66fc5914e228d831bbb AS builder COPY . /src WORKDIR /src From 82e52c16fd6c6ace951eaa60f64af8eb8eeb4c49 Mon Sep 17 00:00:00 2001 From: William Bezuidenhout Date: Tue, 11 Nov 2025 10:08:56 +0200 Subject: [PATCH 6/6] set minimum go version in go.mod --- .github/workflows/goreleaser.yml | 2 +- .github/workflows/scip.yml | 2 +- go.mod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index bb39f6a067..72a4a0f825 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -181,7 +181,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.24.1 + go-version: 1.25 - name: Enable pulling Go modules from private sourcegraph/sourcegraph run: git config --global url."https://${PRIVATE_TOKEN}@github.com/sourcegraph/".insteadOf "https://github.com/sourcegraph/" - run: go test ./... diff --git a/.github/workflows/scip.yml b/.github/workflows/scip.yml index 88e836e774..2df5a1e5c1 100644 --- a/.github/workflows/scip.yml +++ b/.github/workflows/scip.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.24.1 + go-version: 1.25 - name: Set directory to safe for git run: git config --global --add safe.directory $GITHUB_WORKSPACE diff --git a/go.mod b/go.mod index ac72a87347..678a2cd4e8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/sourcegraph/src-cli -go 1.25 +go 1.23.12 require ( cloud.google.com/go/storage v1.30.1