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

Commit

Permalink
Merge pull request #2149 from crazy-max/fix-buildx
Browse files Browse the repository at this point in the history
metrics: fix unexpected usage output shown on cli
  • Loading branch information
glours authored May 23, 2022
2 parents 84ba23e + 8092874 commit 415b410
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions cli/metrics/metadata/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,10 @@ func buildxDriver(dockercfg *configfile.ConfigFile, buildArgs []string) string {
// buildxBuilder returns the builder being used in the build command
func buildxBuilder(buildArgs []string) string {
var builder string
fset := pflag.NewFlagSet("buildx", pflag.ContinueOnError)
fset.String("builder", "", "")
_ = fset.ParseAll(buildArgs, func(flag *pflag.Flag, value string) error {
if flag.Name == "builder" {
builder = value
}
return nil
})
flags := pflag.NewFlagSet("buildx", pflag.ContinueOnError)
flags.Usage = func() {}
flags.StringVar(&builder, "builder", "", "")
_ = flags.Parse(buildArgs)
if len(builder) == 0 {
builder = os.Getenv("BUILDX_BUILDER")
}
Expand Down

0 comments on commit 415b410

Please sign in to comment.