Add a bin packer

This commit is contained in:
Ian Howell 2019-05-15 16:10:50 -05:00
parent 6f6abb3b36
commit f76eb8e027
6 changed files with 14 additions and 2 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
# Packed binaries from github.com/shuLhan/go-bindata
bindata.go
# Binaries for programs and plugins
*.exe
*.exe~

View File

@ -5,10 +5,11 @@ EXECUTABLE_CLI := airshipctl
SCRIPTS_DIR := scripts
PLUGIN_DIR := _plugins
PLUGIN_DIR := _plugins
PLUGIN_BIN := $(PLUGIN_DIR)/bin
PLUGIN_INT := $(patsubst $(PLUGIN_DIR)/internal/%,$(PLUGIN_BIN)/%.so,$(wildcard $(PLUGIN_DIR)/internal/*))
PLUGIN_EXT := $(wildcard $(PLUGIN_DIR)/external/*)
BINDATA := "github.com/shuLhan/go-bindata/cmd/go-bindata"
# linting
LINTER_CMD := "github.com/golangci/golangci-lint/cmd/golangci-lint" run
@ -25,7 +26,7 @@ MIN_COVERAGE := 70
.PHONY: build
build:
build: plugin
@go build -o $(BINDIR)/$(EXECUTABLE_CLI)
.PHONY: test
@ -74,6 +75,7 @@ update-golden:
.PHONY: plugin
plugin: $(PLUGIN_INT)
@for plugin in $(PLUGIN_EXT); do $(MAKE) -C $${plugin}; done
@go run $(BINDATA) $(PLUGIN_BIN)
$(PLUGIN_BIN)/%.so: $(PLUGIN_DIR)/*/%/*.go
@go build -buildmode=plugin -o $@ $^

1
go.mod
View File

@ -13,6 +13,7 @@ require (
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/json-iterator/go v1.1.6 // indirect
github.com/shuLhan/go-bindata v3.4.0+incompatible // indirect
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd // indirect

2
go.sum
View File

@ -177,6 +177,8 @@ github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/ryanuber/go-glob v0.0.0-20170128012129-256dc444b735/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/shirou/gopsutil v0.0.0-20180427012116-c95755e4bcd7/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
github.com/shuLhan/go-bindata v3.4.0+incompatible h1:xlNGW4LRRs+BPBpefnlrgSqb9x7vNF9YyzKeMuuqMpk=
github.com/shuLhan/go-bindata v3.4.0+incompatible/go.mod h1:pkcPAATLBDD2+SpAPnX5vEM90F7fcwHCvvLCMXcmw3g=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041 h1:llrF3Fs4018ePo4+G/HV/uQUqEI1HMDjCeOf2V6puPc=

View File

@ -7,5 +7,8 @@ import (
)
func main() {
if err := RestoreAssets("", "_plugins"); err != nil {
panic(err.Error())
}
cmd.Execute(os.Stdout)
}

View File

@ -4,5 +4,6 @@ package tools
import (
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/shuLahn/go-bindata/cmd/go-bindata"
)