aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
7 daysprepare v0.48.0 release (#3946)upstream-masterTyler French
This PR prepares a minor release to allow downstream users to begin integrating with https://github.com/bazelbuild/rules_go/pull/3919
13 daysAdd exec_compatible_with to @go_sdk//:builder (#3943)Ed Schouten
go_tool_binary() is completely oblivious of toolchains. The reason being that Go toolchains actually depend on their output. Adding a toolchain dependency would thus add a cyclic dependency. This is problematic, because it means that the actions with mnemonic GoToolchainBinaryBuild end up getting scheduled on arbitrary workers. Address this by adding exec_compatible_with to the locations where go_tool_binary() is instantiated, namely the auto-generated BUILD files that are part of Go SDKs. Fixes: #3942
2024-05-13Add support for `--incompatible_enable_proto_toolchain_resolution` (#3919)Fabian Meumertzheim
* Add support for `--incompatible_enable_proto_toolchain_resolution` * Do not use dict union * Fix visibility * Fix buildifier finding * Add proto deps to tests * Attempt to fix integration tests * MOre fixes * Add test deps * Fix test sources * Remove unused load * Fix tests and update to rules_proto 6.0.0 * Add back WORKSPACE deps
2024-05-10generate_test_main: Move timeout handling back to bzltestutil (#3939)DolceTriade
This gives us a determinstic location to ignore for goleak, which we previously had, but was removed as part of #3920.
2024-05-08feat(mode): add `purego` tag when `pure` (#3901)Matt Clarkson
The community has agreed[1] that "pure" builds of Go code should use the `purego` build tag. This change adds that de-facto tag. The minimum version of Gazelle is bumped to `0.36.0` which includes a patch[2] for ignoring the `purego` tag so that the source flies are passed to the compiler for conditional compilation decisions. [1]: https://github.com/golang/go/issues/23172 [2]: https://github.com/bazelbuild/bazel-gazelle/pull/1767
2024-05-07Add docs for Go.Work Support (#3932)Stefan Penner
Docs for https://github.com/bazelbuild/bazel-gazelle/pull/1731
2024-05-07go_test: use different mnemonic for compilation (#3936)Son Luong Ngoc
Closes #3935
2024-05-06Update docs to cover new FilePath ReplaceDirective Support (#3931)Stefan Penner
Update docs to cover new capabilities added by: https://github.com/bazelbuild/bazel-gazelle/pull/1776
2024-05-06prepare patch release 0.47.1 (#3933)Tyler French
Prepare a patch release to include: 54c451550c520d4a26f491fa5f52a97b2dcfa0d7
2024-05-03feat: support syso files in srcs. (#3763)Connor Hindley
* feat: support syso files in srcs. This change adds support for including .syso files in srcs, which enables embedding version and icon info into windows executables. Fixes #2757 * go:generate doesnt work with empty go.mod * remove test, combine syso and o file addToArchive, update comments * update docs
2024-04-30bzltestutil: restore timeout signal handler (#3929)Son Luong Ngoc
In https://github.com/bazelbuild/rules_go/pull/3920, a new mechanism to handle test timeout was introduced. However this broke existing tests that use SIGTERM inside. Restore the original behavior.
2024-04-23prepare rules_go v 0.47 (#3923)Tyler French
This PR prepares the `rules_go` release `v0.47.0`. A few tests are no longer applicable in the `x/tools` repo.
2024-04-18Setting test.timeout according to TEST_TIMEOUT (#3920)Zhongpeng Lin
2024-04-14Use Gazelle's `go_env` in `@rules_go//go` (#3909)Fabian Meumertzheim
2024-04-11Don't ignore the return value of runfiles.merge_all() (#3918)Ed Schouten
I'm running into an issue where data dependencies of C/C++ libraries don't end up being placed in the input roots of Go based tests that depend on these libraries via cgo. It turns out that this is caused by emit_archive() not properly merging runfiles from all GoArchive dependencies. I tried to make a small reproduction case of this under tests/core/cgo, but for the life of me I can't seem to reproduce this. Maybe this can only be observed when cross compiling or using custom C++ toolchains?
2024-04-09Mark `go_sdk` extension as `reproducible` (#3911)Fabian Meumertzheim
2024-04-08patch (#3916)Evgenii Oparin
2024-04-03Reformat with buildifier (#3910)Fabian Meumertzheim
2024-04-03Add //go/private:polyfill_bazel_features.bzl to sources. (#3908)Jimmy Spagnola
* Add //go/private:polyfill_bazel_features.bzl to sources. * Fix format
2024-03-29Add `bazel_features` transitive `.bzl`s to `bzl_library` targets (#3903)Fabian Meumertzheim
2024-03-24[nogo] match regexp againts relative paths (#3898)scaiper
2024-03-21add nolint parsing support for explanations (#3899)Andy Scott
2024-03-19Replace instances of to_json() method with json.encode(..) (#3896)Charles Mita
The to_json and to_proto methods on struct are deprecated and will be removed. The "json" and "proto" builtin modules should be used instead. This replaces instances of `foo.to_json()` with `json.encode(foo)`.
2024-03-17Revert "improving logging for subcommand failure (#3824)" (#3892)Zhongpeng Lin
This reverts commit 55ea579a70958d66f24a907433978b21edd36b29.
2024-03-17gopackagesdriver: fix version check with Bazel development versions (#3893)Jay Conrod
Fixes #3889
2024-03-15Support Go version schema change since 1.21 (#3891)Tim Bai
2024-03-14gopackagesdriver: move and simplify test (#3856)Jay Conrod
* gopackagesdriver: move and simplify test Moved //tests/integration/gopackagesdriver:gopackagesdriver_test to //go/tools/gopackagesdriver:gopackagesdriver_test. Previously the test invoked gopackagesdriver with 'bazel run' in a temporary workspace, which forced Bazel to build it, slowing down the test significantly, especially on Windows. Now, the test embeds the gopackagesdriver library and invokes it directly. The driver still runs in a temporary workspace and still needs to invoke bazel, so the test is still slow, but it's faster than before. Also, a number of other improvements: - gopackagesdriver now sets --consistent_labels if the bazel version is 6.4.0 or later instead of guessing based on the link-stamped rules_go repo name. - bazel_testing.BazelCmd now writes --output_user_root to a .bazelrc file instead of passing it to commands. gopackagesdriver invokes bazel directly, so this lets it use the same output root. * restore output directory path * fix review comment
2024-03-11Cleanup temp dirs in GoToolchainBinaryBuild (#3885)Grzegorz Lukasik
Fixes https://github.com/bazelbuild/rules_go/issues/3884
2024-03-08Update bzlmod.md fix typo (#3882)Murali
2024-03-08Update README.rst to point to correct GH release tags (#3881)Dylan Carney
2024-03-06Bump Go version to 1.21.8 (#3880)Fabian Meumertzheim
* Bump Go version to 1.21.8 * Update WORKSPACE
2024-02-26fix sdk download for common execution platforms (#3874)scaiper
2024-02-26Remove Latin-1 workaround on Bazel 6.4.0+ (#3872)Matt Clarkson
* Remove Latin-1 workaround on Bazel 6.4.0+ The fix for Latin-1 encoded files was landed in [6.4.0] after being landed on Bazel [master]. We can conditionally use the old, unhermetic, `tar` workaround on modern Bazel versions. [master]: https://github.com/bazelbuild/bazel/pull/18448 [6.4.0]: https://github.com/bazelbuild/bazel/pull/19765 * Use `versions` rather than `bazel_features` to avoid circular load pattern Due to the polyfilling of `bazel_features` to avoid double step loading in `WORKSPACE`.
2024-02-16[go_library] add .x file to declared output files in DefaultInfo (#3866)Tyler French
2024-02-16Fixes the Bazel CI error (#3869)Gowroji Sunil
2024-02-15Make exec cfg check for `//go` stricter (#3867)Fabian Meumertzheim
See https://github.com/bazelbuild/bazel/issues/14444#issuecomment-1945642624.
2024-02-14pass correct (non `"main"`) importpath to nogo for `main` package (#3863)Noah S-C
2024-02-14Update toolchains_llvm URL and hash (#3864)Fabian Meumertzheim
2024-02-12Add Bazel version matrix to BCR `presubmit.yml` (#3861)Fabian Meumertzheim
Newly required by BCR policies.
2024-02-09prepare minor release 0.46 (#3854)Tyler French
2024-02-08nogo: Create a go_register_nogo wrapper for WORKSPACE users. (#3842)DolceTriade
* nogo: Create a go_register_nogo wrapper for WORKSPACE users. Currently, workspace users register nogo targets by abusing the go_register_toolchain() function, which calls go_register_nogo(). Instead, we should expose go_register_nogo to workspace users directly. This will allow workspace users and bzlmod users to use the same underlying code because go_register_nogo allows users to specify includes and excludes which you currently can't do with WORKSPACE. Add a test to verify this functionality works in WORKSPACE too. * Exclude running on bazel 5.4.0
2024-02-07Fix invocation of assembler for go1.22 (#3756)Jeremy Quirke
In go1.19 through go1.22-devel (as of golang/go@6382893) a series of changes were made to the way assembly files' symabis are produced. https://go-review.googlesource.com/c/go/+/523337 Most significantly, the packagename now must be passed to the assembler via the -p flag, even when generating only the symabis. The go build system does this, but Bazel Go rules have not, and this finally breaks in go1.22-devel as the compatibility code is removed. Without specifying -p to the assembler, the output symabis file will contain something like: ``` def <unlinkable>.s2Decode ABI0 ``` instead of ``` def github.com/klauspost/compress/s2.s2Decode ABI0 ``` The result is that the compiler will default to using ABIInternal instead of ABI0 if it cannot resolve a match in symabis, which will cause a link failure: ``` Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging github.com/klauspost/compress/s2.Decode: relocation target github.com/klauspost/compress/s2.s2Decode not defined for ABIInternal (but is defined for ABI0) link: error running subcommand external/go_sdk/pkg/tool/darwin_arm64/link: exit status 2 ``` We conservatively only do this for go minor releases later than 1.21.
2024-02-06go_test: ensure external source compilation has data (#3848)Son Luong Ngoc
* go_test: ensure external source compilation has data go_test is split into 2 compilation actions, one for internal test, where package name of the test is the same with library package. ```bash package foo package foo ``` and external test where the package name is different. ```bash package foo package foo_test ``` Ensure that the compilation for external test has access to go_test's data attribute. * add test
2024-01-20Emit nogo facts into a separate archive (#3789)Fabian Meumertzheim
* Use `-linkobj` to directly generate `.x` and `.a` * Extract nogo facts into a separate file * Address review comments
2024-01-20Support custom `GOARM` architecture levels via platform constraints (#3837)LINKIWI
* Update outdated URLs for AMD64 microarchitecture levels * GOARM constraint definitions * Populate GOARM from context data
2024-01-19release patch version 0.45.1 (#3836)Tyler French
This includes various bug fixes from 0.45.0 and fixes the BCR publishing. In the interest of compatibility we are not upgrading any dependencies for this release.
2024-01-18Fix regression in empty `.go` file filtering for nogo (#3832)Fabian Meumertzheim
* Fix regression in empty `.go` file filtering for nogo 6236dd80670cdfe1477a484e98e3f82dbcc28fe9 regressed the nogo exclusion logic for the empty `.go` file generated for targets that otherwise don't contain any `.go` files. The test had been silently disabled a while ago when the name pattern for the empty file was changed. This is fixed by reintroducing the exclusion logic and making the test more strict. * Update go/tools/builders/compilepkg.go Co-authored-by: Tyler French <66684063+tyler-french@users.noreply.github.com> --------- Co-authored-by: Tyler French <66684063+tyler-french@users.noreply.github.com>
2024-01-17Print stack traces without panicking on test timeout (#3833)Fabian Meumertzheim
2024-01-15Disable `layering_check` feature in CGo tests (#3829)Fabian Meumertzheim
`go_*` rules do not emit the module map files required for `layering_check`.
2024-01-12release rules go 0.45.0 (#3825)Tyler French