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

Commit 45682d7

Browse files
minicutscodyoss
authored andcommittedDec 20, 2019
Pass -build_flags as Multiple Args (#357)
Value of -build_flags was passed to 'go' as a single argument. For example when passing -build_flags "-mod vendor", the invoked commandline was `go -mod\ vendor` and the go command errored out because there is no such arg. That has caused confusion, e.g. in #296 Solve this by splitting the argument by a space.
1 parent d1dd49b commit 45682d7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

Diff for: ‎mockgen/reflect.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"os/exec"
2828
"path/filepath"
2929
"runtime"
30+
"strings"
3031
"text/template"
3132

3233
"github.com/golang/mock/mockgen/model"
@@ -116,7 +117,7 @@ func runInDir(program []byte, dir string) (*model.Package, error) {
116117
cmdArgs := []string{}
117118
cmdArgs = append(cmdArgs, "build")
118119
if *buildFlags != "" {
119-
cmdArgs = append(cmdArgs, *buildFlags)
120+
cmdArgs = append(cmdArgs, strings.Split(*buildFlags, " ")...)
120121
}
121122
cmdArgs = append(cmdArgs, "-o", progBinary, progSource)
122123

0 commit comments

Comments
 (0)
This repository has been archived.