diff --git a/.github/workflows/alerting-swagger-gen.yml b/.github/workflows/alerting-swagger-gen.yml index 56359f8cf90..0a42d9f7cab 100644 --- a/.github/workflows/alerting-swagger-gen.yml +++ b/.github/workflows/alerting-swagger-gen.yml @@ -16,7 +16,7 @@ jobs: - name: Set go version uses: actions/setup-go@v4 with: - go-version: '1.22.3' + go-version-file: go.mod - name: Build swagger run: | make -C pkg/services/ngalert/api/tooling post.json api.json diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 435b9ef39b8..70717ef079a 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -58,7 +58,7 @@ jobs: # Go is required for also updating the schema versions as part of the precommit hook: - uses: actions/setup-go@v4 with: - go-version: '1.22.3' + go-version-file: go.mod - uses: actions/setup-node@v4 with: node-version: '18' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a5f40e13661..14981389deb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,7 +48,7 @@ jobs: name: Set go version uses: actions/setup-go@v4 with: - go-version: '1.22.3' + go-version-file: go.mod # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/pr-codeql-analysis-go.yml b/.github/workflows/pr-codeql-analysis-go.yml index 8432ec12cf6..ce9082f4400 100644 --- a/.github/workflows/pr-codeql-analysis-go.yml +++ b/.github/workflows/pr-codeql-analysis-go.yml @@ -36,7 +36,7 @@ jobs: - name: Set go version uses: actions/setup-go@v4 with: - go-version: '1.22.3' + go-version-file: go.mod # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/pr-go-workspace-check.yml b/.github/workflows/pr-go-workspace-check.yml index a9835e25394..0de90a6a8d8 100644 --- a/.github/workflows/pr-go-workspace-check.yml +++ b/.github/workflows/pr-go-workspace-check.yml @@ -22,7 +22,7 @@ jobs: - name: Set go version uses: actions/setup-go@v4 with: - go-version: '1.22.3' + go-version-file: go.mod - name: Workspace Sync run: go work sync diff --git a/.github/workflows/publish-kinds-next.yml b/.github/workflows/publish-kinds-next.yml index 4974057b4f2..4aed6cf36c3 100644 --- a/.github/workflows/publish-kinds-next.yml +++ b/.github/workflows/publish-kinds-next.yml @@ -36,7 +36,7 @@ jobs: - name: "Setup Go" uses: "actions/setup-go@v4" with: - go-version: '1.22.3' + go-version-file: go.mod - name: "Verify kinds" run: go run .github/workflows/scripts/kinds/verify-kinds.go diff --git a/.github/workflows/publish-kinds-release.yml b/.github/workflows/publish-kinds-release.yml index 22ec06cb21d..691cdff3867 100644 --- a/.github/workflows/publish-kinds-release.yml +++ b/.github/workflows/publish-kinds-release.yml @@ -39,7 +39,7 @@ jobs: - name: "Setup Go" uses: "actions/setup-go@v4" with: - go-version: '1.22.3' + go-version-file: go.mod - name: "Verify kinds" run: go run .github/workflows/scripts/kinds/verify-kinds.go diff --git a/.github/workflows/verify-kinds.yml b/.github/workflows/verify-kinds.yml index f91b050689b..88b45660d45 100644 --- a/.github/workflows/verify-kinds.yml +++ b/.github/workflows/verify-kinds.yml @@ -18,7 +18,7 @@ jobs: - name: "Setup Go" uses: "actions/setup-go@v4" with: - go-version: '1.22.3' + go-version-file: go.mod - name: "Verify kinds" run: go run .github/workflows/scripts/kinds/verify-kinds.go diff --git a/contribute/backend/upgrading-go-version.md b/contribute/backend/upgrading-go-version.md index e292bbddf85..f1213807b75 100644 --- a/contribute/backend/upgrading-go-version.md +++ b/contribute/backend/upgrading-go-version.md @@ -6,17 +6,15 @@ Example PR: https://github.com/grafana/grafana/pull/79329 ## The main areas that need to change during the upgrade are: -- https://github.com/grafana/grafana/blob/d8ecea4ed93efb2e4d64a5ee24bc08f3805f413d/scripts/drone/variables.star#L6 -- https://github.com/grafana/grafana/blob/d8ecea4ed93efb2e4d64a5ee24bc08f3805f413d/Makefile#L264 -- https://github.com/grafana/grafana/blob/d8ecea4ed93efb2e4d64a5ee24bc08f3805f413d/Dockerfile#L6 +- [`go.mod`](/go.mod#L3) +- [`go.work`](/go.work#L1) +- [`scripts/drone/variables.star`](/scripts/drone/variables.star#L6) +- [`Makefile`](/Makefile#L12) +- [`Dockerfile`](/Dockerfile#L6) -Make sure to run `make drone` so that changes to `.star` files are reflected and `drone.yml` is generated. +Then, run `go mod tidy` and `go work sync`. Also run `make drone` so changes to `.star` files are reflected and `drone.yml` is updated. ### Additional files to change - Take a look in `.github/workflows` folder for what `go` version is being used there in various workflows. - Make sure to create a PR with the corresponding changes in `grafana/grafana-enterprise` repository. - -## Updating the go.mod file - -Please avoid updating the `go.mod` to the newest version unless really necessary. This ensures backwards compatibility and introduces less breaking changes. Always upgrade Go version in the runtime files above first, let them run for a couple of weeks and only then consider updating the `go.mod` file if necessary.