Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Add a flag to build for all supported platforms #131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func realMain() int {
flags.Var(platformFlag.ArchFlagValue(), "arch", "arch to build for or skip")
flags.Var(platformFlag.OSArchFlagValue(), "osarch", "os/arch pairs to build for or skip")
flags.Var(platformFlag.OSFlagValue(), "os", "os to build for or skip")
flags.BoolVar(&platformFlag.All, "all", false, "build for all known os/arch combination")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combination -> combinations

flags.StringVar(&ldflags, "ldflags", "", "linker flags")
flags.StringVar(&tags, "tags", "", "go build tags")
flags.StringVar(&outputTpl, "output", "{{.Dir}}_{{.OS}}_{{.Arch}}", "output path")
Expand Down
3 changes: 2 additions & 1 deletion platform_flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type PlatformFlag struct {
OS []string
Arch []string
OSArch []Platform
All bool
}

// Platforms returns the list of platforms that were set by this flag.
Expand Down Expand Up @@ -127,7 +128,7 @@ func (p *PlatformFlag) Platforms(supported []Platform) []Platform {
if prefilter == nil {
prefilter = make([]Platform, 0, len(supported))
for _, v := range supported {
if v.Default {
if v.Default || p.All {
add := v
add.Default = false
prefilter = append(prefilter, add)
Expand Down