mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
Merge branch 'master' into fields
This commit is contained in:
commit
e733e78757
@ -169,9 +169,14 @@ build:
|
||||
# Default is `main.go`
|
||||
main: ./cmd/main.go
|
||||
|
||||
# Name of the binary. Default is the name of the project directory.
|
||||
# Name of the binary.
|
||||
# Default is the name of the project directory.
|
||||
binary_name: program
|
||||
|
||||
# Custom build tags.
|
||||
# Default is empty
|
||||
flags: -tags dev
|
||||
|
||||
# Custom ldflags.
|
||||
# Default is `-s -w`
|
||||
ldflags: -s -w
|
||||
|
@ -28,6 +28,7 @@ type Build struct {
|
||||
Goarch []string
|
||||
Main string
|
||||
Ldflags string
|
||||
Flags string
|
||||
BinaryName string `yaml:"binary_name"`
|
||||
Hooks Hooks
|
||||
}
|
||||
|
@ -49,7 +49,11 @@ func build(name, goos, goarch string, ctx *context.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
cmd := []string{"go", "build", "-ldflags=" + ldflags, "-o", output, ctx.Config.Build.Main}
|
||||
cmd := []string{"go", "build"}
|
||||
if ctx.Config.Build.Flags != "" {
|
||||
cmd = append(cmd, strings.Fields(ctx.Config.Build.Flags)...)
|
||||
}
|
||||
cmd = append(cmd, "-ldflags="+ldflags, "-o", output, ctx.Config.Build.Main)
|
||||
if err := run(goos, goarch, cmd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user