mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
cmd/gogio: add ldflags flag for extra flags
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -32,6 +32,7 @@ var (
|
|||||||
printCommands = flag.Bool("x", false, "print the commands")
|
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.")
|
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")
|
linkMode = flag.String("linkmode", "", "set the -linkmode flag of the go tool")
|
||||||
|
extraLdflags = flag.String("ldflags", "", "extra flags to the Go linker")
|
||||||
)
|
)
|
||||||
|
|
||||||
type buildInfo struct {
|
type buildInfo struct {
|
||||||
@@ -100,6 +101,9 @@ func mainErr() error {
|
|||||||
bi.appID = appIDFromPackage(pkgPath)
|
bi.appID = appIDFromPackage(pkgPath)
|
||||||
}
|
}
|
||||||
var ldflags []string
|
var ldflags []string
|
||||||
|
if extra := *extraLdflags; extra != "" {
|
||||||
|
ldflags = append(ldflags, strings.Split(extra, " ")...)
|
||||||
|
}
|
||||||
// Pass appID along, to be used for logging on platforms like Android.
|
// Pass appID along, to be used for logging on platforms like Android.
|
||||||
ldflags = append(ldflags, fmt.Sprintf("-X gioui.org/app/internal/log.appID=%s", bi.appID))
|
ldflags = append(ldflags, fmt.Sprintf("-X gioui.org/app/internal/log.appID=%s", bi.appID))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user