Releases: bazel-contrib/rules_go
v0.38.1
Bug fixes
The go_googleapis upgrade in 0.38.0 is too disruptive. It changes the Go import paths of the proto packages, causing build failures in repos trying to upgrade to rules_go 0.38.0. Reverting the go_googleapis to the master of 2022-12-05 (#3432) for now to make rules_go upgrades easier.
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "dd926a88a564a9246713a9c00b35315f54cbd46b31a26d5d8fb264c07045f05d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.19.5")
Full Changelog: v0.38.0...v0.38.1
v0.38.0
Breaking changes
Starting this release, rules_go requires Bazel 5.3 and golang/x/tools at least 0.3.0. If you are using stardoc, you also need to upgrade it to 0.5.3 to recognize RunEnvironmentInfo
, which is used in this release.
Major new features
This is the first release to support Go 1.20. When on this version of Go, it is highly recommended to use Bazel 6 and set --experimental_output_directory_naming_scheme=diff_against_baseline
to prevent certain unnecessary rebuilds.
What's Changed
- preserve intermediate files if
-work
is specified by @motiejus in #3389 - Adapt
lcov_coverage_test
toexec.Command
change by @fmeum in #3392 - explicitly build relative path for Tool command in lcov_coverage_test by @matloob in #3399
- Add support for building with boringcrypto by @matloob in #3398
- Generalize
boringcrypto
toGOEXPERIMENT
support by @fmeum in #3401 - Replace
cfg = "host"
withcfg = "exec"
by @fmeum in #3404 - always produce .a files at the beginning of a build by @matloob in #3385
- Mark
nogo
targets asmanual
to keep top-level symlinks by @fmeum in #3410 - Refactoring the extld related logic by @linzhp in #3400
- Fix incompatible flags not applied to integration tests by @fmeum in #3415
- chore: remove experimental warning from bzlmod module by @alexeagle in #3418
- Add a clarifying error about dependency cycle found for internal tests by @yushan26 in #3422
- Do not use exec paths for rundir by @fmeum in #3414
- Upgrade org_golang_x_tools to 0.5.0 by @linzhp in #3356
- fix: Relative path of embedsrc by @bakjos in #3407
- Add support for env_inherit by @ttpathan in #3256
- Update stardoc to 0.5.3 by @fmeum in #3427
- Add
env
attribute togo_binary
by @fmeum in #3428
New Contributors
- @matloob made their first contribution in #3399
- @yushan26 made their first contribution in #3422
- @bakjos made their first contribution in #3407
- @ttpathan made their first contribution in #3256
Full Changelog: v0.37.0...v0.38.0
v0.37.0
Major New Features
- Support fetching packages for generated code in the Go Packages Driver
What's Changed
- bzlmod: Add missing
strip_prefix
field tosource.template.json
by @fmeum in #3359 - Declare toolchains in a separate repository by @jfirebaugh in #3348
- Delete legacy actions API by @fmeum in #3173
- go_path: support go:embed of generated files by @S-Chan in #3285
- Properly deprecate
bindata
,go_embed_data
, andgo_embed_data_deps
by @fmeum in #3362 - link.bzl: ignore duplicate dep on coverdata by @robfig in #3032
- feat(pkg-drv): add support for generated files by @JamyDev in #3354
- Remove unused variables in link action by @fmeum in #3367
- Reduce number of declared files in
emit_stdlib
by @fmeum in #3366 - Update docs regarding vendored proto files by @garymm in #3360
- go link: use external linker when in race mode by @motiejus in #3370
- Adding first example by @chrislovecnm in #3317
- fix(packagesdriver): bazelFlags should prefix the command by @JamyDev in #3371
- chore(gpd): export aspect utils for reusability by @JamyDev in #3373
- nogo: Add a _base key to be a default config for all Analyzers. by @DolceTriade in #3351
- Document that
Rlocation
can return relative paths by @fmeum in #3377 - Fix normalization check for
Rlocation
path by @fmeum in #3378 - fix(gpd): Write large target patterns to file by @JamyDev in #3372
- Make Go runfiles library repo mapping aware by @fmeum in #3347
New Contributors
- @jfirebaugh made their first contribution in #3348
- @S-Chan made their first contribution in #3285
- @garymm made their first contribution in #3360
- @motiejus made their first contribution in #3370
- @chrislovecnm made their first contribution in #3317
- @DolceTriade made their first contribution in #3351
Full Changelog: v0.36.0...v0.37.0
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "56d8c5a5c91e1af73eca71a6fab2ced959b67c86d12ba37feedb0a2dfea441a6",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.37.0/rules_go-v0.37.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.37.0/rules_go-v0.37.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.19.3")
v0.36.0
Major new features
- The Go runfiles library developed by @phst at https://github.com/phst/runfiles is now available as
github.com/bazelbuild/rules_go/go/runfiles
(target@io_bazel_rules_go//go/runfiles
) and is now the official way to look up runfiles from Go. It will be made compatible with Bzlmod in a future release.
Note: For improved consistency with runfiles libraries in other languages, thePath
function present in https://github.com/phst/runfiles is calledRlocation
in rules_go. - Adding two new command line flags
--@io_bazel_rules_go//go/config:gc_goopts
and--@io_bazel_rules_go//go/config:gc_linkopts
to accept additional compiler and linker flags.
What's Changed
- bzlmod: Use register_toolchains by @fmeum in #3290
- Remove unused env_execute by @kmicklas in #3276
- Correctly forward InstrumentedFilesInfo from dependencies by @fmeum in #3294
- Parse Go SDK version out of
go version
instead ofVERSION
by @fmeum in #3296 - also write test stderr to json (xml) output file by @rickystewart in #3300
- Bzlmod: Pin Bazel version in CI by @fmeum in #3301
- Allow to select Go SDK version from declared SDKs by @ash2k in #3303
- Use top level VERSION file when it exists by @linzhp in #3309
- synchronize when writing to the JSON converter by @rickystewart in #3311
- update version manifest URL by @benjaminp in #3314
- Symlink "misc" into repository for local_sdk. by @adam-azarchs in #3313
- Ensure compatibility with incompatible flags close to flipping by @fmeum in #3319
- Add additional bzlmod requirements to allow grpc protobufs to work by @shs96c in #3320
- bzlmod: Update pinned Bazel version by @fmeum in #3321
- bzlmod: Set up automated BCR releases by @fmeum in #3324
- bzlmod: Add support for gogo proto compiler by @fmeum in #3323
- gopackagesdriver: move non-Go files to OtherFiles (Fixes #3326) by @michaelarusso in #3327
- bzlmod: Allow yanked versions in CI by @fmeum in #3329
- feat(pkg-drv): allow setting custom aspect and kinds by @JamyDev in #3328
- fix(packages-driver): allow defining additional aspects instead by @JamyDev in #3330
- Add support for parsing Go development versions by @zakcutner in #3333
- Match GOARCH ppc64 to @platforms//cpu:ppc as well. by @mahiuchun in #3336
- bzlmod: Update Publish to BCR app config by @fmeum in #3337
- gopackagesdriver: default to NotHandled:true for package queries by @ian-h-chamberlain in #3338
- fix(packagesdrv): resolve third party go packages by @JamyDev in #3332
- runfiles: port phst/runfiles to rules_go by @sluongng in #3205
- Adding gc_linopts to command line flag by @linzhp in #3342
- Move new runfiles library to
//go/runfiles
by @fmeum in #3341 - Rename
Path
toRlocation
in runfiles library by @fmeum in #3346 - Add 'gc_goopts' flag to command line to allow gc_goopts to propagate by @LWarrens in #3340
New Contributors
- @kmicklas made their first contribution in #3276
- @adam-azarchs made their first contribution in #3313
- @shs96c made their first contribution in #3320
- @michaelarusso made their first contribution in #3327
- @zakcutner made their first contribution in #3333
- @mahiuchun made their first contribution in #3336
- @LWarrens made their first contribution in #3340
Full Changelog: v0.35.0...v0.36.0
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "ae013bf35bd23234d1dea46b079f1e05ba74ac0321423830119d3e787ec73483",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.36.0/rules_go-v0.36.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.36.0/rules_go-v0.36.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.19.3")
v0.35.0
What's Changed
- Add platform contraints for GOAMD64 by @fmeum in #3251
- bzlmod: Fix after breaking change to go_deps.module by @fmeum in #3254
- bzlmod: Check in io_bazel_rules_go -> rules_go patch for tests by @fmeum in #3262
- Export support files needed for using Go's WebAssembly (WASM) output. by @ralimi in #3266
- Add support for --@io_bazel_rules_go//go/toolchain:sdk_version flag. by @JamesMBartlett in #3260
- Add support for
go_binary
to gopackagesdriver. by @DrewMonroe in #3271 - migrating to rbe_preconfig by @aranguyen in #3272
- Add
go_cross_binary
rule for cross-compilation. by @JamesMBartlett in #3261 - delete duplicate return by @Abirdcfly in #3267
- bzlmod: Use repo_name attribute on module instead of patches by @fmeum in #3279
- Fix non_executable_test to work with
@//
labels by @Wyverald in #3281 - bzlmod: Bump version to 0.34.0 by @fmeum in #3280
- bzlmod: Add support for
go_proto_library
by @fmeum in #3283 - Bumping minimal Bazel version to 5.1.0 by @linzhp in #3286
- Getting architecture from JRE by @linzhp in #3282
- Collect coverage for other languages by @fmeum in #3287
New Contributors
- @ralimi made their first contribution in #3266
- @JamesMBartlett made their first contribution in #3260
- @DrewMonroe made their first contribution in #3271
- @aranguyen made their first contribution in #3272
- @Abirdcfly made their first contribution in #3267
Full Changelog: v0.34.0...v0.35.0
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "099a9fb96a376ccbbb7d291ed4ecbdfd42f6bc822ab77ae6f1b5cb9e914e94fa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.35.0/rules_go-v0.35.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.19.1")
v0.34.0
What's Changed
- releaser: fix scrubbing timestamp from patch files by @sluongng in #3180
- Replace Starlark JSON parser with json.decode by @fmeum in #3184
- gopackagesdriver: separates "s" files in pkg info by @iamricard in #3165
- Refactor away references to @io_bazel_rules_go by @fmeum in #3185
- Do not print to stderr if cgo linking succeeds after retry by @fmeum in #3187
- Use param files with go-protoc by @fmeum in #3190
- Don't include non-executable go_binary in dependent's runfiles by @fmeum in #3151
- Link in native libraries of transitive dependencies in archive mode by @fmeum in #3186
- runfiles: remove deprecated api by @sluongng in #3198
- Fix failing open hermeticity test by @fmeum in #3206
- Fix go_googleapis Gazelle patch by @nickgooding in #3193
- Exclude unsupported C/C++ features by @fmeum in #3189
- Allow gomock to take Bazel common attributes by @linzhp in #3207
- Transition on edges not self by @illicitonion in #3116
- Include go_transition_test in bazel aspect by @ian-h-chamberlain in #3160
- Add an example for go_download_sdk.sdks by @fishy in #3139
- tests: nogo over generated code by @sluongng in #3214
- test nogo/coverage: test generated code by @sluongng in #3213
- Remove references to go_transition_test by @linzhp in #3215
- Basic bzlmod setup by @fmeum in #3047
- Run BCR tests against Bazel 6.0.0-pre.20220608.2 by @fmeum in #3223
- Use repo-relative labels in MODULE.bazel by @fmeum in #3226
- upkeep: upgrade to go 1.18.3 and gazelle v0.26.0 by @sluongng in #3220
- nogo: ignore generated source files by @sluongng in #3216
- asm: Pass package path with -p by @fmeum in #3231
- bzlmod: Add support for gomock by @fmeum in #3232
- test cgo: ensure helper script works by @sluongng in #3236
- Fix //tests/legacy/examples/cgo:cgo_lib_test on M1 Macs by @fmeum in #3237
- gopackagesdriver: Descend into go_proto_compiler's deps by @fmeum in #3240
- new_library: remove unused resolver by @sluongng in #3219
- nogo: instantiate type info for generic types when running under Go >=1.18 by @farhaven in #3212
New Contributors
- @iamricard made their first contribution in #3165
- @ian-h-chamberlain made their first contribution in #3160
- @fishy made their first contribution in #3139
- @farhaven made their first contribution in #3212
Full Changelog: v0.33.0...v0.34.0
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.18.4")
v0.33.0
Breaking changes
- cover has been removed in v0.32.0. Please leave a comment if you are affected by this.
Deprecations
- The asm, compile, and pack action generators provided by go_context are deprecated and planned for removal in version v0.36.0. Please leave a comment on the tracking bug if archive and link are not suitable replacements for your use cases.
Bug Fixes
- @sluongng fixed a race condition that could cause non-sandboxed builds of
go_test
targets to fail (#3145) - @abhinav made
//go:embed
work withgo_path
(#3163) - @xytan0056 made gopackagesdriver work with Go 1.18 (#3157)
- @nickgooding ensured that
gomock
can be used with any Gazelle naming convention (#3155) go_library
targets using CGo can now reference unresolved symbols (#3174)
Thanks to all of the contributors!
Compatibility
The minimum required version of Bazel remains at 4.2.1.
Updated dependencies
- Updated
org_golang_x_sys
,org_golang_x_xerrors
,org_golang_google_genproto
,go_googleapis
to their most recent commit as of 2022-06-05
As always, you can use higher versions of rules_go's dependencies by declaring them in WORKSPACE before calling go_rules_dependencies. Lower versions may work but are not supported.
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "685052b498b6ddfe562ca7a97736741d87916fe536623afb7da2824c0211c369",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.33.0/rules_go-v0.33.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.33.0/rules_go-v0.33.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.18.3")
v0.32.0
This release brings many exciting changes
New features
gomock
rule is officially supported in rules_go (doc), replacing the original jmhodges/bazel_gomock repository. Thanks to @jmhodges for the original implementation.- rules_go now generates coverage reports in LCOV format by default (#3117), to be compatible with Bazel's
--combined_report=lcov
. To generate reports in the oldgo tool cover
format, please use--//go/config:cover_format=go_cover
. Thanks to @fmeum @abhinav - supporting windows/arm64 (#3072). Thanks to @nsait-linaro
- nogo config can now takes analyzer_flags (#3082), thanks to @navneethjayendran
Bug fixes
- Consider volatile and stable status files separately (#3079) Thanks to @siddharthab
- Reducing duplicate information passed by go_pkg_info_aspect (#3111)
- Fix include paths for CGo deps in external repositories (#3115) thanks to @fmeum
- Revert change to use resolved shared lib links (#2907), thanks to @glukasiknuro
- Fix lost x_defs on test execution (#3135), thanks to @bozaro
- Let go_binary's executable bit depend on linkmode (#3143) thanks to @fmeum
Deprecations
go_embed_data
and bindata
will be deprecated in rules_go 0.35.0. Users are encourage to migrate to go:embed
and embedsrcs
.
Other changes
- Use output dir for empty packages to be hermetic (#3098), thanks to @joeljeske
- Prevent downgrading platforms (#3076), thanks to @cpsauer
- Doc improvements (#3100), thanks to @sluongng
- Remove legacy proto code for Bazel < 0.21 (#3099), thanks to @cpsauer
- Remove unused coverage code (#3118), thanks to @fmeum
- Moving tests for go_embed_data and gomock to tests/extras (#3122)
- Add command line copts/cxxopts to Cgo compile flags (#3126), thanks to @dchen496
- Reset Go settings for protoc dependencies (#3005), thanks to @fmeum
- Trim transitioned Go settings on non-Go dependencies (#3108), thanks to @fmeum
Updated dependencies
As always, you can use higher versions of rules_go's dependencies by declaring
them in WORKSPACE before calling go_rules_dependencies. Lower versions may
work but are not supported.
org_golang_google_protobuf
updated to v1.28.0org_golang_x_sys
,org_golang_x_xerrors
,org_golang_google_genproto
andgo_googleapis
updated tomaster
, as of 2022-05-09
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "ab21448cef298740765f33a7f5acee0607203e4ea321219f2a4c85a6e0fb0a27",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.32.0/rules_go-v0.32.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.32.0/rules_go-v0.32.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.18.2")
v0.31.0
This is a maintenance release to support Bazel 5.0. No new feature was added since last release.
Changes
- Add support for bazel 5.0.0 (#3068). Thanks to @moisesvega
- Update documents (#3057, #3067). Thanks to @bcspragu and @jeongukjae
- BUILD file clean up. Thanks to @JamyDev
- symlink everything under lib/ when using local SDK (#3074). Thanks to @irfansharif
Updated dependencies
As always, you can use higher versions of rules_go's dependencies by declaring
them in WORKSPACE before calling go_rules_dependencies. Lower versions may
work but are not supported.
platforms
updated to 0.0.5 as of 2022-03-14.bazel_skylib
updated to 1.2.1 as of 2022-03-14.org_golang_x_tools
updated to v0.1.9 as of 2022-03-14.org_golang_x_sys
updated tomaster
as of 2022-03-14.org_golang_google_genproto
updated tomain
as of 2022-03-14.go_googleapis
updated tomaster
as of 2022-03-14.
Thanks @moisesvega for updating the dependencies and preparing the release notes.
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "f2dcd210c7095febe54b804bb1cd3a58fe8435a909db2ec04e31542631cf715c",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.18")
v0.30.0
Changes
-
Add first class support for GOOS=ios (#3013)
-
Always include debug symbols with -c dbg (#3029)
Previously, debugging a go_test target was only possible with an explicit --@io_bazel_rules_go//go/config:debug.
-
go_test: Add env attribute (#3004)
This allows setting environment variables before static initialisers run, and which reference expanded locations.
-
tests/core/cgo: do not assume test is being run from main repo (#2956)
-
reproducibility_test: explicitly build the go_sdk builder (#3026)
-
map bazel's --test_runner_fail_fast to go's -failfast (#3058)
Bug Fixes
- Emit correct header in CGo c-archive (#2874)
- Append path into trimpath if option already exists (#2994)
- Fixed issue with
go_bazel_test
rule on Windows (#3036) - Skipping linker flag for versioned dylib on Darwin (#2989)
- Trim absolute paths in files generated by cgo (#3011)
- builders/cover: register coverage without changing line numbers (#2993)
- cover: use Z instead of underscore for variable name separator (#2995)
- .bazelci/presubmit.yml: remove old flag (#3023)
- builders/gentestmain: register correct cover mode in the coverage report file when enabling race mode (#3019)
- -fsanitize-ignorelist should have an absolute path (#3001)
- internal changes: #2942, #2987, #2988, #2992, #3000, #3035, #3038, #3046
Thanks to all of the contributors
Compatibility
- Bazel 4.2.1 or higher is now required. The previous minimum version
was 4.2.0.
Updated dependencies
As always, you can use higher versions of rules_go's dependencies by declaring
them in WORKSPACE before calling go_rules_dependencies. Lower versions may
work but are not supported.
org_golang_x_tools
updated tov0.1.8
(#3031)org_golang_x_sys
updated tomaster
as of 2022-01-24.org_golang_google_genproto
updated tomaster
as of 2022-01-24.go_googleapis
updated tomaster
as of 2022-01-24.
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.17.6")