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

Support for -race flag [fixes #104] #105

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 @@ -28,6 +28,7 @@ type CompileOpts struct {
Gcflags string
Asmflags string
Tags string
Raceflag bool
Cgo bool
Rebuild bool
GoCmd string
Expand Down Expand Up @@ -107,6 +108,9 @@ func GoCrossCompile(opts *CompileOpts) error {
if opts.Rebuild {
args = append(args, "-a")
}
if opts.Raceflag {
args = append(args, "-race")
}
args = append(args,
"-gcflags", opts.Gcflags,
"-ldflags", opts.Ldflags,
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func realMain() int {
var tags string
var verbose bool
var flagGcflags, flagAsmflags string
var flagCgo, flagRebuild, flagListOSArch bool
var flagCgo, flagRebuild, flagRaceflag, flagListOSArch bool
var flagGoCmd string
flags := flag.NewFlagSet("gox", flag.ExitOnError)
flags.Usage = func() { printUsage() }
Expand All @@ -39,6 +39,7 @@ func realMain() int {
flags.BoolVar(&verbose, "verbose", false, "verbose")
flags.BoolVar(&flagCgo, "cgo", false, "")
flags.BoolVar(&flagRebuild, "rebuild", false, "")
flags.BoolVar(&flagRaceflag, "race", false, "")
flags.BoolVar(&flagListOSArch, "osarch-list", false, "")
flags.StringVar(&flagGcflags, "gcflags", "", "")
flags.StringVar(&flagAsmflags, "asmflags", "", "")
Expand Down Expand Up @@ -133,6 +134,7 @@ func realMain() int {
Gcflags: flagGcflags,
Asmflags: flagAsmflags,
Tags: tags,
Raceflag: flagRaceflag,
Cgo: flagCgo,
Rebuild: flagRebuild,
GoCmd: flagGoCmd,
Expand Down Expand Up @@ -187,6 +189,7 @@ Options:
-ldflags="" Additional '-ldflags' value to pass to go build
-asmflags="" Additional '-asmflags' value to pass to go build
-tags="" Additional '-tags' value to pass to go build
-race Additional '-race' value to pass to go build
-os="" Space-separated list of operating systems to build for
-osarch="" Space-separated list of os/arch pairs to build for
-osarch-list List supported os/arch pairs for your Go version
Expand Down