Skip to content

Commit 612271b

Browse files
authored
add support for custom ldtags and go tags (#919)
1 parent 5929eb2 commit 612271b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cmd/goreleaser/internal/configure.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ type distribution struct {
385385
sboms []config.SBOM
386386
checksum config.Checksum
387387
enableCgo bool
388+
ldFlags string
389+
goTags string
388390
}
389391

390392
func (d *distribution) BuildProject() config.Project {
@@ -393,11 +395,19 @@ func (d *distribution) BuildProject() config.Project {
393395
builds = append(builds, buildConfig.Build(d.name))
394396
}
395397

398+
ldFlags := "-s -w"
399+
if d.ldFlags != "" {
400+
ldFlags = d.ldFlags
401+
}
402+
396403
env := []string{
397404
"COSIGN_YES=true",
398-
"LD_FLAGS=-s -w",
405+
"LD_FLAGS=" + ldFlags,
399406
"BUILD_FLAGS=-trimpath",
400407
}
408+
if d.goTags != "" {
409+
env = append(env, "GO_TAGS="+d.goTags)
410+
}
401411
if !d.enableCgo {
402412
env = append(env, "CGO_ENABLED=0")
403413
}

0 commit comments

Comments
 (0)