Last active
May 24, 2019 23:10
-
-
Save robbertvanginkel/97dfe32e795af9c0dee9b5cd6a6d3de3 to your computer and use it in GitHub Desktop.
rules_go stamping issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bazel test //... --test_output=errors | |
INFO: Invocation ID: 44446d09-160e-4736-a899-168fd8b1e963 | |
INFO: Analyzed 3 targets (0 packages loaded, 0 targets configured). | |
INFO: Found 2 targets and 1 test target... | |
FAIL: //:go_default_test (see /private/var/tmp/_bazel_robbert/df320eb0fd1e2eed12c0b1f31ac9635c/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/go_default_test/test.log) | |
INFO: From Testing //:go_default_test: | |
==================== Test output for //:go_default_test: | |
--- FAIL: TestStamp (0.00s) | |
main_test.go:7: compound = "unknown"; simple = "robbert" | |
FAIL | |
================================================================================ | |
INFO: Elapsed time: 0.203s, Critical Path: 0.07s | |
INFO: 2 processes: 1 remote cache hit, 1 darwin-sandbox. | |
INFO: Build completed, 1 test FAILED, 2 total actions | |
//:go_default_test FAILED in 0.1s | |
/private/var/tmp/_bazel_robbert/df320eb0fd1e2eed12c0b1f31ac9635c/execroot/__main__/bazel-out/darwin-fastbuild/testlogs/go_default_test/test.log | |
INFO: Build completed, 1 test FAILED, 2 total actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") | |
go_library( | |
name = "go_default_library", | |
srcs = ["main.go"], | |
importpath = "github.com/example/project", | |
visibility = ["//visibility:private"], | |
x_defs = { | |
"github.com/example/project.simple": "{BUILD_USER}", | |
"github.com/example/project.compound": "{BUILD_USER}@{BUILD_HOST}", | |
}, | |
) | |
go_binary( | |
name = "project", | |
embed = [":go_default_library"], | |
visibility = ["//visibility:public"], | |
) | |
go_test( | |
name = "go_default_test", | |
srcs = ["main_test.go"], | |
embed = [":go_default_library"], | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
var simple = "unknown" | |
var compound = "unknown" | |
func main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "testing" | |
func TestStamp(t *testing.T) { | |
if compound == "unknown" || simple == "unknown" { | |
t.Errorf("compound = %q; simple = %q", compound, simple) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | |
http_archive( | |
name = "io_bazel_rules_go", | |
url = "https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz", | |
sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329", | |
) | |
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains") | |
go_rules_dependencies() | |
go_register_toolchains() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment