Age | Commit message (Collapse) | Author |
|
49dcd02124 am: 711a453236 am: 6cf433ad1b am: de80525bba am: 96939a977e am: 780ccd3956
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_go/+/2625353
Change-Id: Id4ca3195d832eca77b29b2896b89027d847bb72d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
49dcd02124 am: 711a453236 am: 6cf433ad1b am: de80525bba am: 96939a977e
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_go/+/2625353
Change-Id: I32bead2047a7ae618c2688c609a950bc2055edf4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
49dcd02124 am: 711a453236 am: 6cf433ad1b am: de80525bba
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_go/+/2625353
Change-Id: I7004a94c375c5e52d9a4c49147ceefb8c95fed92
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
49dcd02124 am: 711a453236 am: 6cf433ad1b
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_go/+/2625353
Change-Id: Idebe5ece264c411614cce92bcce1993eaff330b2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
49dcd02124 am: 711a453236
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_go/+/2625353
Change-Id: Id7ea409a5954ab0efd0e8fe6c30ccfe507d9bf95
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
49dcd02124
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_go/+/2625353
Change-Id: I9f9788cf0500a3062862c617370cef7b915bbbc1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
|
|
Create two more files
- LICENSE which is a symlink to LICENSE.txt
- OWNERS
Test: N/A
Change-Id: If65c9397956c6d37c2cf65902b92f1b5c8a51dee
|
|
* Implement //nolint parsing similar to golangci-lint
Look for nolint comments and collect the ranges of where they apply. If
a node immediately follows a range with the same column, expand the
range to include the node.
Add tests that verify errors are filtered out.
* Use a map instead of custom Linters type
Inline the new report function and add some comments about nolint
ranges.
* Add separate tests for various filters
Include a failing test that shows the column issue. Will work on a fix.
* Use ast.CommentMap to associate comments to nodes
This is better than the logic used by golangci-lint in that it does not
incorrectly attribute an inline comment with the next line if it
contains an ast.Node with a matching column (see inline_column test).
* Address PR feedback
Use table driven tests and `CombinedOutput`.
---------
Co-authored-by: Patrick Scott <patrick.scott@observeinc.com>
|
|
The version check introduced in the previous commit did not take into
account that dev versions of Bazel report an empty version string.
|
|
* go_download_sdk: apply extraction workaround to zips on non-windows OSs
The Go distribution contains at least one test file with an invalid
unicode name. Bazel cannot extract the distribution archive on some
operating systems and file systems; Darwin with AFS at least is affected.
For .tar.gz files, we workaround the failure in ctx.download_and_extract
by using the native system tar.
This PR applies a similar workaround for .zip files on non-Windows OSs.
Windows itself is not affected (ctx.download_and_extract works),
so the workaround is not applied there. This is only really needed
when you have a Darwin host and a Windows executor (don't ask).
For #2771
* use rename_files; rewrite comment
* version check
|
|
|
|
|
|
See issue 1469 on https://github.com/bazelbuild/bazel-gazelle
Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
|
|
Also update the version of Gazelle used by the example to get rid of a
usage of `cfg = "host"`.
|
|
* docs: Mention `use_repo` automation
* Update bzlmod.md
|
|
This was never used.
|
|
|
|
Unlike gopls which uses `file=` queries exclusively, golangci-lint uses
the more generic `go list` query syntax. This change allow for file
paths not prefixed with `file=` to be queried correctly.
Additionally, some bugs have been fixed up:
- Packages with different IDs and identical import paths work now.
- WKT for protobufs are no longer skipped when the proto wrapper is
used.`
Change-Id: Ie1fc571f52cf5f6d1ff94b0aea2c05c06bb4be4e
Co-authored-by: Thomas Rampelberg <thomas.rampelberg@airbnb.com>
|
|
Isolating the empty `.go` files generated for targets without sources
and removing them after a build turned out not to solve issues with
concurrent unsandboxed builds causing races. Instead, just generate the
file in a temporary location, which for a truly empty file does not
result in (non-hermetic) source file paths being included in the
archive.
Along the way fix a potential source of non-hermeticity in
`go_bazel_test`.
|
|
|
|
`link` mode produces non-hermetically dangling symlinks by design, which
means that it is broken with remote caching or execution and cannot be
guaranteed to work in other situations.
In the feature, we may be able to support it again based on
`ctx.declare_symlink` and improved unresolved symlink support with
remote caching and execution.
|
|
The environment variable `GOEXPERIMENT` must be defined at the execution
of the builder. Without that, the default build context `build.Default`
used in the builder to filter files using build constraints will not be
able to filter on a `goexperiment.x` build tag.
Fixes #3555
|
|
|
|
The stdlib json currently is not populated with generated files. When
CGO is being used, this means that the file list returned does not
actually compile. This change adds `-compiled=true` to go list's output
which results in the full set required to compile stdlib.
Fixes #3523
Change-Id: Ic06243e7a5de68946d87ff9734156c522bfd8662
Co-authored-by: Thomas Rampelberg <thomas.rampelberg@airbnb.com>
|
|
|
|
* nogo: provide usage doc
Explain basic usage of nogo to new user.
Also provide a quick comparison between `nogo` and other popular linters
such as golangci-lint
* re-word and format with 'fmt 90'
|
|
Validating why this would fail on RBE
|
|
This simplifies the CI config and also ensures that the recent BwoB flip
in CI is disabled in all runs.
|
|
Bazel claims to check that this file has been touched when sharding
tests. It currently doesn't, but that will change soon.
|
|
Co-authored-by: Steven E. Harris <seh@panix.com>
|
|
(#2859)" (#3468)
This reverts commit 026db6df5ad760e9002f627bdb4f6b695c04d76a.
Bazel is migrating to platforms and toolchains resolution, but this
logic frequently reset platforms back based on the value of the
legacy `--cpu` and `--crosstool_top` flags. Instead, users of rules that
still rely on these flags should use the `platform_mappings` file.
|
|
On darwin, in repositories with many transitions configured such as
rules_go.git, the action GoToolchainBinaryBuild could be run multiple
times in parallel by Bazel.
Each of these actions would execute a command like this in a sandbox:
```
$GO build -o $OUTPUT -trimpath \
go/tools/builders/ar.go \
go/tools/builders/asm.go \
go/tools/builders/builder.go \
go/tools/builders/cgo2.go \
go/tools/builders/compilepkg.go \
go/tools/builders/cover.go \
go/tools/builders/edit.go \
go/tools/builders/embedcfg.go \
go/tools/builders/env.go \
go/tools/builders/filter.go \
go/tools/builders/filter_buildid.go \
go/tools/builders/flags.go \
go/tools/builders/generate_nogo_main.go \
go/tools/builders/generate_test_main.go \
go/tools/builders/importcfg.go \
go/tools/builders/link.go \
go/tools/builders/pack.go \
go/tools/builders/read.go \
go/tools/builders/replicate.go \
go/tools/builders/stdlib.go \
go/tools/builders/stdliblist.go \
go/tools/builders/path.go
```
Then, each `go build` process would execute multiple `go tools compile`
command up to the number of max Go routines it is set to. The default
max number of Go routines for each `go build` process is the number of
core on the machine executing the action.
On a local build, this means that we could have up to n x n number of
goroutines running in parallel when combining the asynchronousity of
both Bazel and `go build`.
After upgrading to Go 1.20.x, we observed that such parallelism could
get a local MacOS machine run into a deadlock on the OS-level, halting
spawn of new processes such as `git config`, or new Chrome tab browser.
Typical sampling of a `go build` process stuck in deadlock would result
in the following call graphs:
```
2430 Thread_44978 DispatchQueue_1: com.apple.main-thread (serial)
+ 2430 ??? (in <unknown binary>) [0x1358]
+ 2430 runtime.asmcgocall.abi0 (in go) + 124 [0x100b702ac]
+ 2430 runtime.syscall6.abi0 (in go) + 56 [0x100b71a98]
+ 2430 __wait4_nocancel (in libsystem_kernel.dylib) + 8 [0x1a17a04f4]
2430 Thread_44999
+ 2430 runtime.asmcgocall.abi0 (in go) + 201 [0x100b702f9]
+ 2430 runtime.pthread_cond_timedwait_relative_np_trampoline.abi0 (in go) + 28 [0x100b717ec]
+ 2430 _pthread_cond_wait (in libsystem_pthread.dylib) + 1276 [0x1a17d45a0]
+ 2430 __psynch_cvwait (in libsystem_kernel.dylib) + 8 [0x1a1797710]
2430 Thread_45038
+ 2430 runtime.kevent_trampoline.abi0 (in go) + 40 [0x100b71518]
+ 2430 kevent (in libsystem_kernel.dylib) + 8 [0x1a179a060]
```
We could not reproduce outside of Bazel (using bash & to parallelize `go
build`). We also could not reproduce this issue with Go 1.19 releases.
Let's apply a rudimentry workaround by limitting the concurrency of `go
build` process by setting it's max Go routines to 1. This should make
this and future race conditions happen a lot less on all platforms.
By doing this, we rely more on Bazel and less on Go runtime to saturate
our CPU resources.
This change should not affect remote execution as the default
ResourceSet for each action is set at 1 CPU and 250MB RAM.
|
|
Fixes failures such as:
https://buildkite.com/bazel/rules-go-golang/builds/5066#01878f4b-c637-4080-b1df-47ff2e0e5f63/276-300
caused by bazelbuild/continuous-integration#1585.
|
|
* Add defines for assembly build
Fixes https://github.com/bazelbuild/rules_go/issues/1894 by adding GOOS_
GOARCH_ and GOOS_GOARCH_ defines for building assembly.
* Return a copy of args
* Use build.Default variables for os and arch
Add a compilation test that uses another architecture with conditional
inclusion of an assembly function. This mimics a real library that fails
to build under rules_go.
---------
Co-authored-by: Patrick Scott <patrick.scott@observeinc.com>
|
|
This was flipped in bazelbuild/continuous-integration#1579, but breaks
//tests/core/cgo:versioned_dylib_test.
|
|
|
|
We never compile CGo with coverage instrumentation and the stdlib contains no user-provided C/C++ code, so linking coverage runtimes is never needed.
|
|
The definition of the go_rule function in now prints the following
message:
The go_rule function has been removed. Use rule directly instead.
Remove reference to go_rule from the go_context documentation.
Co-authored-by: Zhongpeng Lin <zplin@uber.com>
|
|
https://groups.google.com/g/golang-announce/c/Xdv6JL9ENs8
|
|
|
|
* Reference `rulesGoRepositoryName` (sourced from environment variable) instead of hard-coding `@io_bazel_rules_go` repo name.
* gopackagesdriver: Inject rules_go repo name via x_defs
This ensures that we always specify the correct repo name when invoking
the aspect, even with Bzlmod (where users usually refer to rules_go as
`@rules_go`, not `@io_bazel_rules_go`, but could choose any apparent
repository name for it).
---------
Co-authored-by: Brice <33697112+bricedp@users.noreply.github.com>
|
|
|
|
* go_register_toolchains: update sdk_kinds
After 89e3296c36b789e8623e1178a59506547a98419e, we have renamed
_go_download_sdk to go_download_sdk_rule so that we could re-use the
implementation inside the Bazel Module Extension setup.
Update go_register_toolchains to pick up this change.
* Update sdk.bzl
|
|
(#3512)
* Fix use of `//go` by exposing `@org_golang_x_sys` when using Bzlmod
Running `bazel run //go` (or `bazel run @rules_go//go` from another module) fails when using Bzlmod because the `@org_golang_x_sys` repository is not visible. Without Bzlmod, the repository is loaded through a WORKSPACE dependency and the error does not happen.
Two-step minimal reproduction from root of this repo:
1. `touch WORKSPACE.bzlmod`
2. `bazel run --enable_bzlmod //go`
Here's the error that produces:
```shell
$ bazel run --enable_bzlmod //go
DEBUG: gazelle@0.27.0/MODULE.bazel:7:6: WARNING: The bazel_gazelle Bazel module is still highly experimental and subject to change at any time. Only use it to try out bzlmod for now.
WARNING: For repository 'com_google_protobuf', the root module requires module version protobuf@3.19.2, but got protobuf@3.19.6 in the resolved dependency graph.
ERROR: /Users/brice/Documents/Code/rules_go/go/tools/go_bin_runner/BUILD.bazel:11:11: no such package '@[unknown repo 'org_golang_x_sys' requested from @]//unix': The repository '@[unknown repo 'org_golang_x_sys' requested from @]' could not be resolved: No repository visible as '@org_golang_x_sys' from main repository and referenced by '//go/tools/go_bin_runner:go_bin_runner_lib'
ERROR: Analysis of target '//go:go' failed; build aborted:
INFO: Elapsed time: 3.043s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (45 packages loaded, 865 targets configured)
currently loading: go/platform
ERROR: Build failed. Not running target
```
Here's the point in the BUILD file where this repository is being referenced:
https://github.com/bazelbuild/rules_go/blob/e558f56df9995f571e49de336c3831d407d9ff70/go/tools/go_bin_runner/BUILD.bazel#L25
* Remove `process_unix.go` and use `process.go` for all platforms. Eliminates dependency on `@org_golang_x_sys`.
* Add Bzlmod test for //go
---------
Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
|
|
By updating gazelle to a version that maintains a central registry of
gazelle overrides, specifying `build_file_proto_mode` on
`github.com/gogo/protobuf` is no longer necessary.
This will allow us to get rid of the rules_go exception after the next
rules_go release.
|
|
This relands cd9817098856f6b993937c2dd794a69850cd90ea, which was
reverted by commit 4660427960cde81412031f93a2c2fb9fc6fcffa2.
The Xcode toolchain is now only enabled in tests.
|
|
Context: https://github.com/bazelbuild/bazel-central-registry/pull/547
|
|
|
|
This reverts commit cd9817098856f6b993937c2dd794a69850cd90ea.
|
|
|