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

Support go1.13 -trimpath option #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions go.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type CompileOpts struct {
ModMode string
Cgo bool
Rebuild bool
TrimPath bool
GoCmd string
}

Expand Down Expand Up @@ -108,6 +109,9 @@ func GoCrossCompile(opts *CompileOpts) error {
if opts.Rebuild {
args = append(args, "-a")
}
if opts.TrimPath {
args = append(args, "-trimpath")
}
if opts.ModMode != "" {
args = append(args, "-mod", opts.ModMode)
}
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func realMain() int {
var tags string
var verbose bool
var flagGcflags, flagAsmflags string
var flagCgo, flagRebuild, flagListOSArch bool
var flagCgo, flagRebuild, flagTrimPath, flagListOSArch bool
var flagGoCmd string
var modMode string
flags := flag.NewFlagSet("gox", flag.ExitOnError)
Expand All @@ -43,6 +43,7 @@ func realMain() int {
flags.BoolVar(&verbose, "verbose", false, "verbose")
flags.BoolVar(&flagCgo, "cgo", false, "")
flags.BoolVar(&flagRebuild, "rebuild", false, "")
flags.BoolVar(&flagTrimPath, "trimpath", false, "")
flags.BoolVar(&flagListOSArch, "osarch-list", false, "")
flags.StringVar(&flagGcflags, "gcflags", "", "")
flags.StringVar(&flagAsmflags, "asmflags", "", "")
Expand Down Expand Up @@ -161,6 +162,7 @@ func realMain() int {
ModMode: modMode,
Cgo: flagCgo,
Rebuild: flagRebuild,
TrimPath: flagTrimPath,
GoCmd: flagGoCmd,
}

Expand Down Expand Up @@ -221,6 +223,7 @@ Options:
-parallel=-1 Amount of parallelism, defaults to number of CPUs
-gocmd="go" Build command, defaults to Go
-rebuild Force rebuilding of package that were up to date
-trimpath Remove all file system paths from the resulting executable

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it some wrong tab here?

-verbose Verbose mode

Output path template:
Expand Down