Skip to content

Commit c83e36a

Browse files
committed
Update plugin_package.go
1 parent 07a9db1 commit c83e36a

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

plugin/plugin_package.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package plugin
22

33
import (
44
"errors"
5+
"strings"
56
)
67

78
const (
@@ -41,14 +42,23 @@ type BuildTarget struct {
4142
Arch string `json:"arch"`
4243
CGO bool `json:"cgo"`
4344
Env []string `json:"env"`
45+
Tags []string `json:"tags"`
4446
IncludeSymbols bool `json:"include_symbols"`
4547
}
4648

4749
func (t BuildTarget) EnvVariables() []string {
48-
variables := append(t.cgoEnvVariables(), "GOOS="+t.OS, "GOARCH="+t.Arch)
50+
variables := append(t.cgoEnvVariables(), "GOOS="+t.OS, "GOARCH="+t.Arch, t.tags())
4951
return append(variables, t.Env...)
5052
}
5153

54+
func (t BuildTarget) tags() string {
55+
if len(t.Tags) == 0 {
56+
return ""
57+
}
58+
tagString := strings.Join(t.Tags, ",")
59+
return "GOFLAGS=-tags=" + tagString
60+
}
61+
5262
func (t BuildTarget) cgoEnvVariables() []string {
5363
// default is to tool at the param. Can be overridden by adding `CGO_ENABLED=1` to BuildTarget.Env
5464
if !t.CGO {
@@ -78,9 +88,9 @@ func (t BuildTarget) cgoEnvVariables() []string {
7888
}
7989

8090
var DefaultBuildTargets = []BuildTarget{
81-
{OS: GoOSLinux, Arch: GoArchAmd64},
82-
{OS: GoOSLinux, Arch: GoArchArm64},
83-
{OS: GoOSWindows, Arch: GoArchAmd64},
84-
{OS: GoOSDarwin, Arch: GoArchAmd64},
85-
{OS: GoOSDarwin, Arch: GoArchArm64},
91+
{OS: GoOSLinux, Arch: GoArchAmd64, Tags: []string{"grpcnotrace"}},
92+
{OS: GoOSLinux, Arch: GoArchArm64, Tags: []string{"grpcnotrace"}},
93+
{OS: GoOSWindows, Arch: GoArchAmd64, Tags: []string{"grpcnotrace"}},
94+
{OS: GoOSDarwin, Arch: GoArchAmd64, Tags: []string{"grpcnotrace"}},
95+
{OS: GoOSDarwin, Arch: GoArchArm64, Tags: []string{"grpcnotrace"}},
8696
}

0 commit comments

Comments
 (0)