Skip to content

Releases: bazelbuild/rules_go

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()

v0.24.11

19 Jan 23:30
462dfa3
Compare
Choose a tag to compare
v0.24.11 Pre-release
Pre-release

New Go versions

Go 1.15.7 and 1.14.14 are now supported.

WORKSPACE code

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

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

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

go_rules_dependencies()

go_register_toolchains()

v0.25.1

23 Dec 21:33
Compare
Choose a tag to compare
v0.25.1 Pre-release
Pre-release

Bug fixes

  • Fixed an issue in go_test with capturing XML output when changing directories.
  • Paths in error messages are now relativized. This should reduce noise from Bazel sandbox directories. (thanks @robfig)
  • go_local_sdk provides better error messages when Go is built for multiple platforms. (thanks @prattmic)
  • Multiple compatibility fixes for Go 1.16beta1.

WORKSPACE code

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

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

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

go_rules_dependencies()

go_register_toolchains(version = "1.15.6")

v0.24.10

23 Dec 21:33
Compare
Choose a tag to compare
v0.24.10 Pre-release
Pre-release

Bug fixes

  • Paths in error messages are now relativized. This should reduce noise from Bazel sandbox directories. (thanks @robfig)
  • go_local_sdk provides better error messages when Go is built for multiple platforms. (thanks @prattmic)
  • Multiple compatibility fixes for Go 1.16beta1.

WORKSPACE code

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

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

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

go_rules_dependencies()

go_register_toolchains()

v0.24.9

03 Dec 22:50
Compare
Choose a tag to compare
v0.24.9 Pre-release
Pre-release

New Go versions

Go 1.15.6 and 1.14.13 are now supported.

WORKSPACE code

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

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

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

go_rules_dependencies()

go_register_toolchains()

v0.25.0

02 Dec 20:56
8c81912
Compare
Choose a tag to compare
v0.25.0 Pre-release
Pre-release

Changes

  • go_download_sdk and go_register_toolchains can now download any version of Go from golang.org/dl without the need for hardcoded support in rules_go.
    • Consequently, the version parameter must be set to a string like "1.15.5" or to "host". This requires a change to WORKSPACE for most users. See go_register_toolchains for details.
    • go_download_sdk queries https://golang.org/dl in order to find SHA-256 of toolchains. Bazel won't cache downloaded files without these. If your build has limited network access, use version = "host" or set the sdks and urls attributes in go_download_sdk.
    • As a result of this change, rules_go will no longer need patch releases for new Go versions. The v0.24 branch will still be patched as long as it's supported.
  • Package conflicts are now errors rather than warnings. The linker already reports errors for most of these since Go 1.15.
  • rules_go now uses Bazel's modern C/C++ Starlark linker API.
  • go_path supports the include_transitive attribute, which controls whether transitively imported packages are included (thanks @steeve)
  • go_test changes to the test directory in an init function run before other package inits instead of in main (thanks @dragonsinth)
  • Several deprecated features were removed. See Deprecation schedule for information on removals.
    • go_rule wrapper.
    • go_archive_aspect and GoAspectProvider.
    • It is now an error when a go_binary or go_test depends on another go_binary or go_test.
    • --feature flags are no longer used for configuration. Use flags like --@io_bazel_rules_go//go/config:pure instead.

Compatibility

  • Go 1.13 is no longer supported.
  • Bazel 3.4.0 is now required.
  • This release is expected to be compatible with Bazel 4.0.0. Earlier rules_go releases may not work due to incompatible changes in the C/C++ APIs.

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.1.
  • rules_cc is updated to master as of 2020-12-01.
  • bazel_skylib is updated to 1.0.3.
  • org_golang_x_tools is updated to master as of 2020-12-01.
  • com_github_golang_protobuf is updated to v1.4.3.
  • org_golang_google_genproto is updated to master as of 2020-12-01.
  • go_googleapis is updated to master as of 2020-12-01.

WORKSPACE code

NOTE: The code below has changed. In go_register_toolchains, version must be set to a string like "1.15.5" or to "host" unless a Go toolchain is declared earlier.

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

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "6f111c57fd50baf5b8ee9d63024874dd2a014b069426156c55adbf6d3d22cb7b",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.25.0/rules_go-v0.25.0.tar.gz",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.25.0/rules_go-v0.25.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.15.5")

v0.24.8

02 Dec 19:57
Compare
Choose a tag to compare
v0.24.8 Pre-release
Pre-release

Bug fixes

  • go_test no longer requires TestMain to call os.Exit (thanks @rabbbit)
  • @io_bazel_rules_go//proto/wkt:field_mask_go_proto,
    source_context_go_proto, and type_go_proto are now wrappers around the
    pre-generated sources in google.golang.org/protobuf. This should eliminate
    linker conflicts.
  • go_proto_library now declares implicit dependencies on both APIv1 and
    APIv2 packages. This may increase build time (both sets of packages will be
    compiled) but is needed for compatibility with protobuf 3.14.0.
    go_proto_library needs both sets of packages, since we don't know which
    version of protobuf is used at analysis time.
  • go_binary and go_test now force internal linking in pure mode, since
    a C/C++ toolchain is not available. This should produce better error messages
    on platforms that don't support internal linking.

WORKSPACE code

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

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

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

go_rules_dependencies()

go_register_toolchains()

v0.24.7

12 Nov 23:28
Compare
Choose a tag to compare
v0.24.7 Pre-release
Pre-release

New Go versions

Go 1.15.5 and 1.14.12 are now supported.

WORKSPACE code

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

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

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

go_rules_dependencies()

go_register_toolchains()