From ad05898543581c104626437fb496306f1befb265 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Fri, 17 May 2024 13:54:00 +0800 Subject: [PATCH] build: checkFlag fix (for Go+) --- internal/build/build.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/build/build.go b/internal/build/build.go index 37bfa7ac..3772dd71 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -371,6 +371,7 @@ var ( "-x": false, // -x: print the commands "-tags": true, // -tags 'tag,list': a space-separated list of build tags to consider satisfied during the build "-pkgdir": true, // -pkgdir dir: install and load all packages from dir instead of the usual locations + "-ldflags": true, // --ldflags 'flag list': arguments to pass on each go tool link invocation } ) @@ -403,7 +404,11 @@ func SkipFlagArgs(args []string) int { } func checkFlag(arg string, i *int, verbose *bool, swflags map[string]bool) { - if hasarg, ok := swflags[arg]; ok { + if pos := strings.IndexByte(arg, '='); pos > 0 { + if verbose != nil && arg == "-v=true" { + *verbose = true + } + } else if hasarg, ok := swflags[arg]; ok { if hasarg { *i++ } else if verbose != nil && arg == "-v" {