diff --git a/metadata.json b/metadata.json index 90f9832..ac1ee6f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,5 +1,5 @@ { - "version": "2.2.1", + "version": "2.3.0", "package": "github.com/nikogura/gomason", "description": "A tool for testing, building, signing, and publishing your project from a clean workspace.", "repository": "http://localhost:8081/artifactory/generic-local", diff --git a/pkg/gomason/building.go b/pkg/gomason/building.go index 8aea1f8..aa4a8c7 100644 --- a/pkg/gomason/building.go +++ b/pkg/gomason/building.go @@ -98,7 +98,14 @@ func Build(gopath string, meta Metadata, branch string, verbose bool) (err error // This gets weird because go's exec shell doesn't like the arg format that gox expects // Building it thusly keeps the various quoting levels straight - args := gox + ` -osarch="` + targetstring + `"` + " ./..." + cgo := "" + + // build with cgo if we're told to do so. + if meta.BuildInfo.Cgo { + cgo = " -cgo" + } + + args := gox + cgo + ` -osarch="` + targetstring + `"` + " ./..." // Calling it through sh makes everything happy cmd := exec.Command("sh", "-c", args) diff --git a/pkg/gomason/gomason.go b/pkg/gomason/gomason.go index 97cd2ba..f2a808c 100644 --- a/pkg/gomason/gomason.go +++ b/pkg/gomason/gomason.go @@ -33,6 +33,7 @@ type Metadata struct { type BuildInfo struct { Targets []string `json:"targets,omitempty"` Extras []ExtraArtifact `json:"extras,omitempty"` + Cgo bool `json:"cgo,omitempty"` } // ExtraArtifact is an extra file built from a template at build time