Go rules for Bazel
WORKSPACE
codeload("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "51dc53293afe317d2696d4d6433a4c33feedb7748a9e352072e2ec3c0dafd2c6",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.20.5")
This patch release cherry-picked two bug fixes related to Go package driver from master
goexperiment.*
build tags by @lbcjbb in https://github.com/bazelbuild/rules_go/pull/3556
go_path
's link
mode by @fmeum in https://github.com/bazelbuild/rules_go/pull/3565
--incompatible_disable_starlark_host_transitions
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3560
.go
file in a random location by @fmeum in https://github.com/bazelbuild/rules_go/pull/3566
use_repo
automation by @fmeum in https://github.com/bazelbuild/rules_go/pull/3573
go_host_compatible_sdk
repository by @ylecornec in https://github.com/bazelbuild/rules_go/pull/3543
gazelle:prefix
can be replaced by go.mod
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3577
go_download_sdk
with Bazel dev versions by @fmeum in https://github.com/bazelbuild/rules_go/pull/3580
Full Changelog: https://github.com/bazelbuild/rules_go/compare/v0.39.1...v0.40.0
WORKSPACE
codeload("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "bfc5ce70b9d1634ae54f4e7b495657a18a04e0d596785f672d35d5f505ab491a",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.40.0/rules_go-v0.40.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.20.5")
Full Changelog: https://github.com/bazelbuild/rules_go/compare/v0.39.0...v0.39.1
WORKSPACE
codeload("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "6b65cb7917b4d1709f9410ffe00ecf3e160edf674b78c54a894471320862184f",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.20.2")
go
binary available as a target by @fmeum in https://github.com/bazelbuild/rules_go/pull/3429
filter_transition_label
workaround by @fmeum in https://github.com/bazelbuild/rules_go/pull/3438
x_defs
values by @fmeum in https://github.com/bazelbuild/rules_go/pull/3473
//go
usable in scripts run with bazel run
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3474
error
script in go_cross_binary
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3481
CC
if it contains whitespace by @fmeum in https://github.com/bazelbuild/rules_go/pull/3491
runtime/cgo
with pure = False
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3492
ctx.readdir
instead of ls
for SDK platform detection by @fmeum in https://github.com/bazelbuild/rules_go/pull/3497
Full Changelog: https://github.com/bazelbuild/rules_go/compare/v0.38.0...v0.39.0
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
codeload("@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: https://github.com/bazelbuild/rules_go/compare/v0.38.0...v0.38.1
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.
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.
-work
is specified by @motiejus in https://github.com/bazelbuild/rules_go/pull/3389
lcov_coverage_test
to exec.Command
change by @fmeum in https://github.com/bazelbuild/rules_go/pull/3392
boringcrypto
to GOEXPERIMENT
support by @fmeum in https://github.com/bazelbuild/rules_go/pull/3401
cfg = "host"
with cfg = "exec"
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3404
nogo
targets as manual
to keep top-level symlinks by @fmeum in https://github.com/bazelbuild/rules_go/pull/3410
env
attribute to go_binary
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3428
Full Changelog: https://github.com/bazelbuild/rules_go/compare/v0.37.0...v0.38.0
strip_prefix
field to source.template.json
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3359
bindata
, go_embed_data
, and go_embed_data_deps
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3362
emit_stdlib
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3366
Rlocation
can return relative paths by @fmeum in https://github.com/bazelbuild/rules_go/pull/3377
Rlocation
path by @fmeum in https://github.com/bazelbuild/rules_go/pull/3378
Full Changelog: https://github.com/bazelbuild/rules_go/compare/v0.36.0...v0.37.0
WORKSPACE
codeload("@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")
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, the Path
function present in https://github.com/phst/runfiles is called Rlocation
in rules_go.--@io_bazel_rules_go//go/config:gc_goopts
and --@io_bazel_rules_go//go/config:gc_linkopts
to accept additional compiler and linker flags.go version
instead of VERSION
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3296
//go/runfiles
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3341
Path
to Rlocation
in runfiles library by @fmeum in https://github.com/bazelbuild/rules_go/pull/3346
Full Changelog: https://github.com/bazelbuild/rules_go/compare/v0.35.0...v0.36.0
WORKSPACE
codeload("@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")
go_binary
to gopackagesdriver. by @DrewMonroe in https://github.com/bazelbuild/rules_go/pull/3271
go_cross_binary
rule for cross-compilation. by @JamesMBartlett in https://github.com/bazelbuild/rules_go/pull/3261
@//
labels by @Wyverald in https://github.com/bazelbuild/rules_go/pull/3281
go_proto_library
by @fmeum in https://github.com/bazelbuild/rules_go/pull/3283
Full Changelog: https://github.com/bazelbuild/rules_go/compare/v0.34.0...v0.35.0
WORKSPACE
codeload("@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")
Full Changelog: https://github.com/bazelbuild/rules_go/compare/v0.33.0...v0.34.0
WORKSPACE
codeload("@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")