From 17a2cab5dd7adc383e10d1184036a727a332aebc Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 20 Jun 2025 11:27:52 +0100 Subject: [PATCH 1/6] Update Go version in tests to `1.25.0-rc.1` --- go/actions/test/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/actions/test/action.yml b/go/actions/test/action.yml index 667ee4751ba9..f10b22b2719c 100644 --- a/go/actions/test/action.yml +++ b/go/actions/test/action.yml @@ -4,7 +4,7 @@ inputs: go-test-version: description: Which Go version to use for running the tests required: false - default: "~1.24.0" + default: "1.25.0-rc.1" run-code-checks: description: Whether to run formatting, code and qhelp generation checks required: false From da188aee58685522413b1921364a5b43d5ab311f Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 20 Jun 2025 13:37:45 +0100 Subject: [PATCH 2/6] Bazel: Use Go `1.25rc1` --- MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index 6c27900a9fbb..9de912e85f40 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -233,7 +233,7 @@ use_repo( ) go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") -go_sdk.download(version = "1.24.0") +go_sdk.download(version = "1.25rc1") go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") go_deps.from_file(go_mod = "//go/extractor:go.mod") From fefa1fd55c751196e6158ab5215a1d017f3399b7 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 20 Jun 2025 13:38:02 +0100 Subject: [PATCH 3/6] Go: Request `go1.25rc1` toolchain --- go/extractor/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/extractor/go.mod b/go/extractor/go.mod index 8dce8565a58a..51415c98d25e 100644 --- a/go/extractor/go.mod +++ b/go/extractor/go.mod @@ -2,7 +2,7 @@ module github.com/github/codeql-go/extractor go 1.24 -toolchain go1.24.0 +toolchain go1.25rc1 // when updating this, run // bazel run @rules_go//go -- mod tidy From 6a996b6c032dc9f5ecb1ec72f0f04586404a5ea6 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 23 Jun 2025 13:48:15 +0100 Subject: [PATCH 4/6] Patch `rules_go` to avoid failures with Go 1.25 --- MODULE.bazel | 2 +- .../rules_go/0.55.1-codeql.1/MODULE.bazel | 54 +++++++++++++++++++ ...codeql_do_not_use_nocoverageredesign.patch | 25 +++++++++ .../rules_go/0.55.1-codeql.1/source.json | 9 ++++ .../registry/modules/rules_go/metadata.json | 30 +++++++++++ 5 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/MODULE.bazel create mode 100644 misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/patches/codeql_do_not_use_nocoverageredesign.patch create mode 100644 misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/source.json create mode 100644 misc/bazel/registry/modules/rules_go/metadata.json diff --git a/MODULE.bazel b/MODULE.bazel index 9de912e85f40..9c1a8ffea245 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -15,7 +15,7 @@ local_path_override( # see https://registry.bazel.build/ for a list of available packages bazel_dep(name = "platforms", version = "0.0.11") -bazel_dep(name = "rules_go", version = "0.50.1") +bazel_dep(name = "rules_go", version = "0.55.1-codeql.1") bazel_dep(name = "rules_pkg", version = "1.0.1") bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1") bazel_dep(name = "rules_python", version = "0.40.0") diff --git a/misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/MODULE.bazel b/misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/MODULE.bazel new file mode 100644 index 000000000000..374dee44953f --- /dev/null +++ b/misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/MODULE.bazel @@ -0,0 +1,54 @@ +module( + name = "rules_go", + # Updated by the Publish to BCR app. + version = "0.55.1-codeql.1", + compatibility_level = 0, + repo_name = "io_bazel_rules_go", +) + +# The custom repo_name is used to prevent our bazel_features polyfill for WORKSPACE builds from +# conflicting with the real bazel_features repo. +bazel_dep(name = "bazel_features", version = "1.9.1", repo_name = "io_bazel_rules_go_bazel_features") +bazel_dep(name = "bazel_skylib", version = "1.2.0") +bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "rules_proto", version = "7.0.2") +bazel_dep(name = "protobuf", version = "29.0-rc2.bcr.1", repo_name = "com_google_protobuf") +bazel_dep(name = "rules_shell", version = "0.3.0") + +go_sdk = use_extension("//go:extensions.bzl", "go_sdk") + +# Don't depend on this repo by name, use toolchains instead. +# See https://github.com/bazel-contrib/rules_go/blob/master/go/toolchains.rst +go_sdk.from_file( + name = "go_default_sdk", + go_mod = "//:go.mod", +) +use_repo( + go_sdk, + "go_host_compatible_sdk_label", + "go_toolchains", + # This name is ugly on purpose to avoid a conflict with a user-named SDK. + "io_bazel_rules_nogo", +) + +register_toolchains("@go_toolchains//:all") + +bazel_dep(name = "gazelle", version = "0.36.0") + +go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") +go_deps.from_file(go_mod = "//:go.mod") +use_repo( + go_deps, + "com_github_gogo_protobuf", + "com_github_golang_mock", + "com_github_golang_protobuf", + "com_github_pmezard_go_difflib", + "org_golang_google_genproto", + "org_golang_google_grpc", + "org_golang_google_grpc_cmd_protoc_gen_go_grpc", + "org_golang_google_protobuf", + "org_golang_x_net", + "org_golang_x_tools", + # Exported by gazelle specifically for rules_go. + "bazel_gazelle_go_repository_config", +) diff --git a/misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/patches/codeql_do_not_use_nocoverageredesign.patch b/misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/patches/codeql_do_not_use_nocoverageredesign.patch new file mode 100644 index 000000000000..6490a5b2489c --- /dev/null +++ b/misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/patches/codeql_do_not_use_nocoverageredesign.patch @@ -0,0 +1,25 @@ +diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl +index 156bb25..feb55eb 100644 +--- a/go/private/sdk.bzl ++++ b/go/private/sdk.bzl +@@ -443,13 +443,13 @@ def _sdk_build_file(ctx, platform, version, experiments): + ctx.file("ROOT") + goos, _, goarch = platform.partition("_") + +- pv = parse_version(version) +- if pv != None and pv[1] >= 20: +- # Turn off coverageredesign GOEXPERIMENT on 1.20+ +- # until rules_go is updated to work with the +- # coverage redesign. +- if not "nocoverageredesign" in experiments and not "coverageredesign" in experiments: +- experiments = experiments + ["nocoverageredesign"] ++ # pv = parse_version(version) ++ # if pv != None and pv[1] >= 20: ++ # # Turn off coverageredesign GOEXPERIMENT on 1.20+ ++ # # until rules_go is updated to work with the ++ # # coverage redesign. ++ # if not "nocoverageredesign" in experiments and not "coverageredesign" in experiments: ++ # experiments = experiments + ["nocoverageredesign"] + + ctx.template( + "BUILD.bazel", diff --git a/misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/source.json b/misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/source.json new file mode 100644 index 000000000000..010a6e7b7914 --- /dev/null +++ b/misc/bazel/registry/modules/rules_go/0.55.1-codeql.1/source.json @@ -0,0 +1,9 @@ +{ + "integrity": "sha256-nXL3uJBBKK+5jUa774KtciPsn/NxjUGa+zVf3dn5SEo=", + "strip_prefix": "", + "url": "https://github.com/bazel-contrib/rules_go/releases/download/v0.55.1/rules_go-v0.55.1.zip", + "patches": { + "codeql_do_not_use_nocoverageredesign.patch": "sha256-v/eo1XWUpNLWKVAUcR/MlIYqKAGTS+2eWopxTl8lEwk=" + }, + "patch_strip": 1 +} diff --git a/misc/bazel/registry/modules/rules_go/metadata.json b/misc/bazel/registry/modules/rules_go/metadata.json new file mode 100644 index 000000000000..61f9ca2f9092 --- /dev/null +++ b/misc/bazel/registry/modules/rules_go/metadata.json @@ -0,0 +1,30 @@ +{ + "homepage": "https://github.com/bazelbuild/rules_go", + "maintainers": [ + { + "email": "fabian@meumertzhe.im", + "github": "fmeum", + "name": "Fabian Meumertzheim", + "github_user_id": 4312191 + }, + { + "email": "zplin@uber.com", + "github": "linzhp", + "name": "Zhongpeng Lin", + "github_user_id": 98395 + }, + { + "email": "tfrench@uber.com", + "github": "tyler-french", + "name": "Tyler French", + "github_user_id": 66684063 + } + ], + "repository": [ + "github:bazel-contrib/rules_go" + ], + "versions": [ + "0.55.1-codeql.1" + ], + "yanked_versions": {} +} From 967e8af0754e3b43081675dc3e061e59dab28d30 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 23 Jun 2025 15:22:41 +0100 Subject: [PATCH 5/6] Add build matrix with different Go versions --- .github/workflows/go-tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index 994aba441826..64883d9f6cd9 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -14,7 +14,7 @@ on: pull_request: paths: - "go/**" - - "!go/documentation/**" + - "!go/documentation/**" - "shared/**" - .github/workflows/go-tests.yml - .github/actions/** @@ -31,6 +31,10 @@ jobs: if: github.repository_owner == 'github' name: Test Linux (Ubuntu) runs-on: ubuntu-latest-xl + strategy: + fail-fast: false + matrix: + go-version: ['~1.24.0', '1.25.0-rc.1'] steps: - name: Check out code uses: actions/checkout@v4 @@ -38,3 +42,4 @@ jobs: uses: ./go/actions/test with: run-code-checks: true + go-test-version: ${{ matrix.go-version }} From 5a98c43da585b95781c4560ded8e6a179f7465b9 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 23 Jun 2025 15:29:14 +0100 Subject: [PATCH 6/6] Ensure unique name for qhelp artifact --- go/actions/test/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/actions/test/action.yml b/go/actions/test/action.yml index f10b22b2719c..a050c9bc3d73 100644 --- a/go/actions/test/action.yml +++ b/go/actions/test/action.yml @@ -17,11 +17,11 @@ runs: using: composite steps: - name: Set up Go ${{ inputs.go-test-version }} + id: setup-go uses: actions/setup-go@v5 with: go-version: ${{ inputs.go-test-version }} cache: false - id: go - name: Set up CodeQL CLI uses: ./.github/actions/fetch-codeql @@ -65,7 +65,7 @@ runs: if: inputs.run-code-checks == 'true' && !cancelled() uses: actions/upload-artifact@v4 with: - name: qhelp-markdown + name: qhelp-markdown-${{ steps.setup-go.outputs.go-version }} path: go/qhelp-out/**/*.md - name: Cache compilation cache