cmd/gogio: add -linkmode flags

For experimenting with https://github.com/golang/go/issues/38918.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-05-08 08:31:26 +02:00
parent bcbea7e653
commit 0ad8f85c05
+4
View File
@@ -31,6 +31,7 @@ var (
version = flag.Int("version", 1, "app version (for -buildmode=exe)")
printCommands = flag.Bool("x", false, "print the commands")
keepWorkdir = flag.Bool("work", false, "print the name of the temporary work directory and do not delete it when exiting.")
linkMode = flag.String("linkmode", "", "set the -linkmode flag of the go tool")
)
type buildInfo struct {
@@ -118,6 +119,9 @@ func mainErr() error {
// Pass along arguments to the app.
ldflags = append(ldflags, fmt.Sprintf("-X gioui.org/app.extraArgs=%s", strings.Join(appArgs, "|")))
}
if m := *linkMode; m != "" {
ldflags = append(ldflags, "-linkmode="+m)
}
bi.ldflags = strings.Join(ldflags, " ")
if err := build(bi); err != nil {
return err