-
-
Notifications
You must be signed in to change notification settings - Fork 668
Deprecation schedule
This document lists public interfaces and features that are deprecated and will be removed soon, as well as features that have already been removed. For each item in this document, the deprecation rationale is listed, along with the last supported rules_go release and the release when the functionality is scheduled to be removed.
The Go Team provides support for the current and previous minor versions of Go. For example, if Go 1.15 is the current version, then 1.15 and 1.14 are supported. Only supported versions receive bug fixes and security updates, so users are strongly encouraged to update to those versions.
Each minor version of rules_go only supports the minor versions of Go that were supported at the time of release. rules_go may break compatibility with older versions.
go
command, which is very sensitive
to the action's environment. It can provide incorrect, non-deterministic information,
and it will stop working in Go 1.17 without a fix, since GOPATH mode will likely be
removed.runtime.Version
to find the Go version. Use the toolchain
API to get other information about the toolchain.nogo
binaries. When #2473 is resolved,
nogo
binaries can depend on regular go_library
packages, so there's
no need for a parallel graph of go_tool_library
targets. As such,
go_tool_library
is redundant with go_library
and should not be used.go_library
instead of go_tool_library
. Existing
go_tool_library
targets in org_golang_x_tools
will be replaced with
aliases.--@io_bazel_rules_go//go/config:race
. --features
and --define
flags do not trigger configuration changes, and they won't work with
config_setting
or select
.--@io_bazel_rules_go//go/config:race
instead of --features=race
.--incompatible_remap_main_repo
, changed how default labels are interpreted
in rule definitions. Labels without explicit workspace names are now
considered to be inside the workspace of the file containing the call
to rule
. When go_rule
is used, that's @io_bazel_rules_go
, which
is probably unexpected and unwanted for most users.go_rule
, use the native rule
. Add a
toolchain dependency of type @io_bazel_rules_go//go:toolchain
. Add a label
attribute named _go_context_data
that defaults to
@io_bazelrules_go//:go_context_data
.objc = True
should no longer be necessary in most cases. In 0.19.0, this triggers
a legacy path where .m and .mm files are built in an objc_library
.
In 0.20.0, this legacy path and the objc_library
target will be removed.
Attributes specific to objc_library
like module_map
will no longer
be accepted.objc = True
and attributes specific to
objc_library
from Go rules. If you need to embed Go code within a
larger Objective C binary, build a go_binary
with
linkmode = "c-archive"
, then depend on the .cc
target in the deps
attribute of a objc_library
or similar rule. For example, if the
go_binary
is named "foo"
, you can add "foo.cc"
to deps
.go_register_toolchains()
automatically selects the newest
version of Go unless a version is explicitly specified.go_register_toolchains()
automatically selects the newest
version of Go unless a version is explicitly specified.go tool vet
no longer works starting in Go 1.12, and
go_vet_test
will no longer work.nogo
rule with vet = True
. Add it to the
toolchain in the WORKSPACE call to go_register_toolchains
. See
nogo for instructions.-importcfg
option in particular will let us reduce
symlinking before compiling.go_register_toolchains()
automatically selects the newest
version of Go unless a version is explicitly specified.@bazel_gazelle
.gazelle
rule
from @io_bazel_rules_go//go:def.bzl
to @bazel_gazelle//:def.bzl
.importpath
of go_library
was
determined by its position in the repository relative to //:go_prefix
.
This implicit dependency has made it difficult to support repositories where
Go is not at the root of the tree. We have encouraged explicit importpath
attributes for several releases. go_prefix
will be removed and
importpath
will be mandatory for go_library
and go_proto_library
.importpath
automatically.library
attribute in go_library
, go_binary
,
and go_test
was replaced with the embed
attribute, which allows
multiple libraries to be embedded instead of just one. We plan to remove
library
to simplify our implementation.linkstamp
has been made entirely redundant by
x_defs
, which allows multiple stamped variables in both go_binary
and go_library
.go_repository
rule has moved from @io_bazel_rules_go
to
@bazel_gazelle
. Gazelle is a core part of go_repository
, and moving
go_repository
to that repository allows us to reduce rules_go's
dependence on Gazelle.go_repository
.go_sdk
is redundant with the go_host_sdk_
,
go_download_sdk
, and go_local_sdk
rules. go_repositories
should
not be used anymore; go_rules_dependencies
and go_register_toolchains
should be called instead.go_library
with
cgo = True
.@io_bazel_rules_go//proto:def.bzl
. There's no need to preserve the rules
in go_proto_library.bzl
.-proto=default
or # gazelle:proto default
.