$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: tests/BUILD.bazel
no changes added to commit (use "git add" and/or "git commit -a")
$ bazel test //tests:go_default_test
INFO: Analyzed target //tests:go_default_test (2 packages loaded, 22 targets configured).
INFO: Found 1 test target...
Target //tests:go_default_test up-to-date:
bazel-bin/tests/go_default_test_/go_default_test
INFO: Elapsed time: 0.831s, Critical Path: 0.70s
INFO: 7 processes: 1 internal, 6 linux-sandbox.
INFO: Build completed successfully, 7 total actions
//tests:go_default_test PASSED in 0.1s
Executed 1 out of 1 test: 1 test passes.
INFO: Build completed successfully, 7 total actions
The additional stuff that gazelle put (that it should not have put) in the BUILD file causes the global tests to fail:
$ bazel test //...
INFO: Analyzed 16 targets (27 packages loaded, 301 targets configured).
INFO: Found 15 targets and 1 test target...
ERROR: /home/ji/bazel_gomock/tests/BUILD.bazel:67:11: GoCompilePkg tests/go_default_library.a failed (Exit 1): builder failed: error executing command bazel-out/host/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src bazel-out/k8-fastbuild/bin/tests/hello_mock.go -src ... (remaining 17 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox builder failed: error executing command bazel-out/host/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src bazel-out/k8-fastbuild/bin/tests/hello_mock.go -src ... (remaining 17 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
compilepkg: missing strict dependencies:
/home/ji/.cache/bazel/_bazel_ji/7a27ddd7c8683af35cb30bc7964830b9/sandbox/linux-sandbox/35/execroot/com_github_jmhodges_bazel_gomock/bazel-out/k8-fastbuild/bin/tests/hello_mock.go: import of "github.com/golang/mock/gomock"
/home/ji/.cache/bazel/_bazel_ji/7a27ddd7c8683af35cb30bc7964830b9/sandbox/linux-sandbox/35/execroot/com_github_jmhodges_bazel_gomock/bazel-out/k8-fastbuild/bin/tests/hello_mock_renamed.go: import of "github.com/golang/mock/gomock"
/home/ji/.cache/bazel/_bazel_ji/7a27ddd7c8683af35cb30bc7964830b9/sandbox/linux-sandbox/35/execroot/com_github_jmhodges_bazel_gomock/bazel-out/k8-fastbuild/bin/tests/helloer_copyright.go: import of "github.com/golang/mock/gomock"
/home/ji/.cache/bazel/_bazel_ji/7a27ddd7c8683af35cb30bc7964830b9/sandbox/linux-sandbox/35/execroot/com_github_jmhodges_bazel_gomock/bazel-out/k8-fastbuild/bin/tests/helloer_source_mock.go: import of "github.com/golang/mock/gomock"
No dependencies were provided.
Check that imports in Go sources match importpath attributes in deps.
INFO: Elapsed time: 0.599s, Critical Path: 0.14s
INFO: 7 processes: 5 internal, 2 linux-sandbox.
FAILED: Build did NOT complete successfully
//tests:go_default_test NO STATUS
FAILED: Build did NOT complete successfully
Let me qualify "breaks":
At
master
(dd57d5599d64ebde72aff1c91df41ef32baece51
):Test everything works:
As does, of course:
Now, run gazelle:
Now, while
bazel test //tests:
succeeds:The additional stuff that gazelle put (that it should not have put) in the BUILD file causes the global tests to fail: