Skip to content

Commit

Permalink
added ability to specify cgo in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Nik Ogura committed Aug 30, 2018
1 parent c2797ce commit 65666f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 8 additions & 1 deletion pkg/gomason/building.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pkg/gomason/gomason.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 65666f1

Please sign in to comment.