aboutsummaryrefslogtreecommitdiff
path: root/go/private/rules/binary.bzl
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2019-08-23 10:42:55 -0400
committerGitHub <noreply@github.com>2019-08-23 10:42:55 -0400
commitb656c7cd4a3ed4a58a4b1e4610f5c7f9b2027fb5 (patch)
tree9cbbd6e0a9605519af8cb20dda1b33a2fba4edd9 /go/private/rules/binary.bzl
parent9b2a17d9fa747165f1f08f6229c2a66c74067f0e (diff)
downloadbazelbuild-rules_go-b656c7cd4a3ed4a58a4b1e4610f5c7f9b2027fb5.tar.gz
Multiple fixes for go1.13 compatibility (#2194)
* Upgrade gazelle past go1.13 incompatibility. * go_test: set testing flags after calling testmain.MainStart for compliance with golang.org/cl/173722. * go_binary: don't set package name to "main" in plugin and shared modes. * Disable errorsas test in tools that requires 'go list'. This test was disabled before 1.13. * Disable ipv4 test due to "package height" error triggered by external test depending on both internal package and package under test.
Diffstat (limited to 'go/private/rules/binary.bzl')
-rw-r--r--go/private/rules/binary.bzl5
1 files changed, 4 insertions, 1 deletions
diff --git a/go/private/rules/binary.bzl b/go/private/rules/binary.bzl
index 455fa942..e0a8c2b7 100644
--- a/go/private/rules/binary.bzl
+++ b/go/private/rules/binary.bzl
@@ -44,6 +44,8 @@ load(
"@io_bazel_rules_go//go/private:mode.bzl",
"LINKMODES",
"LINKMODE_NORMAL",
+ "LINKMODE_PLUGIN",
+ "LINKMODE_SHARED",
)
load(
"@bazel_skylib//lib:shell.bzl",
@@ -71,7 +73,8 @@ def _go_binary_impl(ctx):
"""go_binary_impl emits actions for compiling and linking a go executable."""
go = go_context(ctx)
- library = go.new_library(go, importable = False, is_main = True)
+ is_main = go.mode.link not in (LINKMODE_SHARED, LINKMODE_PLUGIN)
+ library = go.new_library(go, importable = False, is_main = is_main)
source = go.library_to_source(go, ctx.attr, library, ctx.coverage_instrumented())
name = ctx.attr.basename
if not name: