Skip to content

Releases: bazel-contrib/rules_go

v0.32.0

11 May 21:44
9a51225
Compare
Choose a tag to compare

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 old go 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.0
  • org_golang_x_sys, org_golang_x_xerrors, org_golang_google_genproto and go_googleapis updated to master, 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

21 Mar 16:40
8553d97
Compare
Choose a tag to compare

This is a maintenance release to support Bazel 5.0. No new feature was added since last release.

Changes

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 to master as of 2022-03-14.
  • org_golang_google_genproto updated to main as of 2022-03-14.
  • go_googleapis updated to master 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

24 Jan 22:31
b21d9f4
Compare
Choose a tag to compare

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 to v0.1.8 (#3031)
  • org_golang_x_sys updated to master as of 2022-01-24.
  • org_golang_google_genproto updated to master as of 2022-01-24.
  • go_googleapis updated to master 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")

v0.29.0

06 Oct 23:46
4955534
Compare
Choose a tag to compare

Changes

  • nogo analyzers may now depend on go_library rules (#2922).

    This is a major upgrade to nogo usability that enables the use of
    the popular staticcheck tool, via
    https://github.com/sluongng/staticcheck-codegen.

    This requires an update to Gazelle v0.24

    Many thanks to @thomas-wk

  • Editor / IDE integration (gopackagesdriver) now supports automatic target detection (#2932).

    No user input is required after the GOPACKAGESDRIVER setup.
    This effectively deprecates the following environment variables:

    • GOPACKAGESDRIVER_BAZEL_TARGETS
    • GOPACKAGESDRIVER_BAZEL_QUERY
    • GOPACKAGESDRIVER_BAZEL_TAG_FILTERS

    Many thanks to @steeve for his ongoing development of gopackagesdriver

  • The rules_cc dependency has been removed (#2950).

  • rules_go tool builds are now reproducible (#2952).

  • cgo-related bug fixes: #2930, #2925, #2947, #2926.

Thanks to all of the contributors.

Compatibility

  • Bazel 4.2.0 or higher is now required. The previous minimum version
    was 4.0.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.

  • bazel_skylib updated to v1.1.1
  • org_golang_x_tools updated to v0.1.7
  • org_golang_x_sys updated to master as of 2021-10-06.
  • org_golang_google_genproto updated to master as of 2021-10-06.
  • go_googleapis updated to master as of 2021-10-06.

WORKSPACE code

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.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.1")

http_archive(
    name = "bazel_gazelle",
    sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
    ],
)

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

gazelle_dependencies()

v0.28.0

07 Jul 22:49
ddbaa8e
Compare
Choose a tag to compare

Changes

  • Experimental editor / IDE integration added in the form of a
    gopackagesdriver tool that reports information about the Bazel workspace
    to gopls (or any other tool based on golang.org/x/tools/go/packages).
    See the Editor setup
    on the wiki for information and setup instructions. Huge thanks to @steeve
    for shipping this.
  • Target platform may be automatically inferred from --crosstool_top and
    --cpu for iOS and Android platforms that still require these flags.
    Again, thanks to @steeve.
  • go_proto_library no longer implicitly depends on APIv1 Well Known Type
    packages. Since protoc 3.14, the Well Known Types declare APIv2 package paths,
    which means generated code that imports them will import APIv2 packages,
    so the APIv1 dependencies are unnecessary.

Compatibility

  • Bazel 4.0.0 (LTS) or higher is now required. The previous minimum version
    was 3.5.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 to v0.1.4
  • org_golang_x_sys updated to master as of 2021-06-30.
  • rules_cc updated to main as of 2021-06-30.
  • org_golang_google_protobuf updated to v1.27.1.
  • org_github_golang_protobuf updated to v1.5.2.
  • org_golang_google_genproto updated to master as of 2021-06-30.
  • go_googleapis updated to master as of 2021-06-30.

WORKSPACE code

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
    ],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains(version = "1.16.5")

v0.27.0

18 Mar 15:02
63ed47c
Compare
Choose a tag to compare
v0.27.0 Pre-release
Pre-release

Updated dependencies

This release updates golang.org/x/tools, which was mistakenly not updated in v0.26.0. Additionally, the latest version of golang.org/x/tools requires golang.org/x/sys/execabs, so that module is added as a new dependency.

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 is updated to v0.1.0.
  • org_golang_x_sys is added at master as of 2021-03-17.

WORKSPACE code

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "69de5c704a05ff37862f7e0f5534d4f479418afc21806c887db544a316f3cb6b",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz",
    ],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains(version = "1.16.2")

v0.24.14

17 Mar 18:22
b377638
Compare
Choose a tag to compare
v0.24.14 Pre-release
Pre-release

New Go versions

Go 1.16.2, 1.16.1, 1.15.10, and 1.15.9 are now supported.

WORKSPACE code

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "e0015762cdeb5a2a9c48f96fb079c6a98e001d44ec23ad4fa2ca27208c5be4fb",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.14/rules_go-v0.24.14.tar.gz",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.24.14/rules_go-v0.24.14.tar.gz",
    ],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains()

v0.26.0

08 Mar 20:39
ddc5747
Compare
Choose a tag to compare
v0.26.0 Pre-release
Pre-release

Changes

  • //go:embed directives are supported in Go 1.16. Patterns are matched against both static and generated files, including directory artifacts. Embeddable files must be listed in the new embedsrcs attribute. Gazelle v0.23.0 will generate these attributes automatically.
  • go_binary now provides CcInfo in the c-archive and c-shared link modes. This should let cc_library and other rules reference these targets through deps directly. Thanks @steeve.
  • TEST_TMPDIR is no longer set to TMPDIR in tests. Thanks @mikedanese.
  • Several small improvements in error and diagnostic output.

Compatibility

  • Bazel 3.5.0 is now required. The previous minimum version was 3.4.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.

  • platforms is updated to 0.0.4.
  • rules_cc is updated to master as of 2021-03-05.
  • org_golang_x_tools is updated to master as of 2021-03-05.
  • org_golang_google_genproto is updated to master as of 2021-03-05.
  • go_googleapis is updated to master as of 2021-03-05.

WORKSPACE code

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "7c10271940c6bce577d51a075ae77728964db285dac0a46614a7934dc34303e6",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.26.0/rules_go-v0.26.0.tar.gz",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.26.0/rules_go-v0.26.0.tar.gz",
    ],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains(version = "1.16")

v0.24.13

16 Feb 23:18
702f3ba
Compare
Choose a tag to compare
v0.24.13 Pre-release
Pre-release

New Go versions

Go 1.16 is now supported.

WORKSPACE code

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "52d0a57ea12139d727883c2fef03597970b89f2cc2a05722c42d1d7d41ec065b",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.13/rules_go-v0.24.13.tar.gz",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.24.13/rules_go-v0.24.13.tar.gz",
    ],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains()

v0.24.12

05 Feb 00:58
8e9d11a
Compare
Choose a tag to compare
v0.24.12 Pre-release
Pre-release

New Go versions

Go 1.15.8 and 1.14.15 are now supported.

WORKSPACE code

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "4d838e2d70b955ef9dd0d0648f673141df1bc1d7ecf5c2d621dcc163f47dd38a",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.12/rules_go-v0.24.12.tar.gz",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.24.12/rules_go-v0.24.12.tar.gz",
    ],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains()