Skip to content

Commit

Permalink
Add build tags option to u-root command
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan O'Leary <[email protected]>
  • Loading branch information
rjoleary authored and probot-auto-merge[bot] committed Aug 3, 2021
1 parent 2bac8ef commit f0689d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion u-root.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var (
statsOutputPath *string
statsLabel *string
shellbang *bool
tags *string
)

func init() {
Expand Down Expand Up @@ -80,8 +81,9 @@ func init() {
shellbang = flag.Bool("shellbang", false, "Use #! instead of symlinks for busybox")

statsOutputPath = flag.String("stats-output-path", "", "Write build stats to this file (JSON)")

statsLabel = flag.String("stats-label", "", "Use this statsLabel when writing stats")

tags = flag.String("tags", "", "Comma separated list of build tags")
}

type buildStats struct {
Expand Down Expand Up @@ -187,6 +189,7 @@ func isRecommendedVersion(v string) bool {
// on exit.
func Main() error {
env := golang.Default()
env.BuildTags = strings.Split(*tags, ",")
if env.CgoEnabled {
log.Printf("Disabling CGO for u-root...")
env.CgoEnabled = false
Expand Down

0 comments on commit f0689d3

Please sign in to comment.