remove the system go-bindata requirement.

close #1
close #3
This commit is contained in:
Will Scott 2018-03-08 11:34:30 -08:00
parent 41e56f6a41
commit e47554cae2
4 changed files with 82 additions and 30 deletions

11
Gopkg.lock generated
View File

@ -152,6 +152,15 @@
] ]
revision = "f33734611e84d5fe45f35eccf0174f4836af4542" revision = "f33734611e84d5fe45f35eccf0174f4836af4542"
[[projects]]
name = "github.com/shuLhan/go-bindata"
packages = [
".",
"go-bindata"
]
revision = "73d86c43eaae43914eb3ef264bcb4d8cb604fb51"
version = "v3.3.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "golang.org/x/sys" name = "golang.org/x/sys"
@ -177,6 +186,6 @@
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "03c2415c162eb74c1efe403a53e129a83d3612e0b21ac4ec8ea88dd27ea3f145" inputs-digest = "cfd4567b0cd553bc4594b7f8bebcb91be475dfd112fd8740f65b5ba4a8253181"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

@ -24,6 +24,7 @@
# go-tests = true # go-tests = true
# unused-packages = true # unused-packages = true
required = ["github.com/shuLhan/go-bindata/go-bindata"]
[[constraint]] [[constraint]]
name = "github.com/alecthomas/kingpin" name = "github.com/alecthomas/kingpin"
@ -56,3 +57,7 @@
[[constraint]] [[constraint]]
branch = "master" branch = "master"
name = "github.com/measurement-kit/go-measurement-kit" name = "github.com/measurement-kit/go-measurement-kit"
[[constraint]]
name = "github.com/shuLhan/go-bindata"
version = "3.3.0"

View File

@ -1,5 +1,3 @@
GO_BINDATA_VERSION = $(shell go-bindata --version | cut -d ' ' -f2 | head -n 1 || echo "missing")
REQ_GO_BINDATA_VERSION = 3.2.0
GO ?= go GO ?= go
build: build:
@ -8,10 +6,7 @@ build:
.PHONY: build .PHONY: build
bindata: bindata:
ifneq ($(GO_BINDATA_VERSION),$(REQ_GO_BINDATA_VERSION)) @$(GO) run vendor/github.com/shuLhan/go-bindata/go-bindata/*.go \
go get -u github.com/shuLhan/go-bindata/...;
endif
@go-bindata \
-nometadata \ -nometadata \
-o internal/bindata/bindata.go -pkg bindata \ -o internal/bindata/bindata.go -pkg bindata \
data/...; data/...;

View File

@ -5,6 +5,7 @@
package bindata package bindata
import ( import (
"bytes" "bytes"
"compress/gzip" "compress/gzip"
@ -37,6 +38,7 @@ func bindataRead(data []byte, name string) ([]byte, error) {
return buf.Bytes(), nil return buf.Bytes(), nil
} }
type asset struct { type asset struct {
bytes []byte bytes []byte
info fileInfoEx info fileInfoEx
@ -77,7 +79,7 @@ func (fi bindataFileInfo) Sys() interface{} {
return nil return nil
} }
var _dataDefaultConfigJson = []byte( var _bindataDataDefaultconfigjson = []byte(
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x94\xcd\x6e\xe3\x38\x0c\xc7\xef\x7d\x0a\x41\xe7\x3a\xcd\x62\x6f\x39" + "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x94\xcd\x6e\xe3\x38\x0c\xc7\xef\x7d\x0a\x41\xe7\x3a\xcd\x62\x6f\x39" +
"\xee\x6d\x0f\xbb\x1d\x60\xe6\x56\x14\x82\x62\xd1\x36\x31\x32\xa9\x11\xe9\x64\x82\x41\xdf\x7d\x20\x35\x89\xed\x7e" + "\xee\x6d\x0f\xbb\x1d\x60\xe6\x56\x14\x82\x62\xd1\x36\x31\x32\xa9\x11\xe9\x64\x82\x41\xdf\x7d\x20\x35\x89\xed\x7e" +
"\x4d\x8f\xe2\x9f\xa2\xc8\x1f\x29\xfe\xba\x31\xc6\x3a\xbb\x33\xf6\xdb\x80\x62\x50\xcc\x89\xa7\x6c\xee\xef\xff\xff" + "\x4d\x8f\xe2\x9f\xa2\xc8\x1f\x29\xfe\xba\x31\xc6\x3a\xbb\x33\xf6\xdb\x80\x62\x50\xcc\x89\xa7\x6c\xee\xef\xff\xff" +
@ -99,25 +101,35 @@ var _dataDefaultConfigJson = []byte(
"\x1d\x20\xcb\xf3\x47\xb7\xdb\xcd\x76\xf3\xd7\xf3\xb6\x73\x48\xa5\x83\x65\xde\x98\x04\x48\x2f\xd7\x9f\x6e\x7e\x07" + "\x1d\x20\xcb\xf3\x47\xb7\xdb\xcd\x76\xf3\xd7\xf3\xb6\x73\x48\xa5\x83\x65\xde\x98\x04\x48\x2f\xd7\x9f\x6e\x7e\x07" +
"\x00\x00\xff\xff\x0f\x7e\x15\xb3\x6d\x05\x00\x00") "\x00\x00\xff\xff\x0f\x7e\x15\xb3\x6d\x05\x00\x00")
func dataDefaultConfigJsonBytes() ([]byte, error) { func bindataDataDefaultconfigjsonBytes() ([]byte, error) {
return bindataRead( return bindataRead(
_dataDefaultConfigJson, _bindataDataDefaultconfigjson,
"data/default-config.json", "data/default-config.json",
) )
} }
func dataDefaultConfigJson() (*asset, error) {
bytes, err := dataDefaultConfigJsonBytes()
func bindataDataDefaultconfigjson() (*asset, error) {
bytes, err := bindataDataDefaultconfigjsonBytes()
if err != nil { if err != nil {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "data/default-config.json", size: 0, md5checksum: "", mode: os.FileMode(0), modTime: time.Unix(0, 0)} info := bindataFileInfo{
name: "data/default-config.json",
size: 0,
md5checksum: "",
mode: os.FileMode(0),
modTime: time.Unix(0, 0),
}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
var _dataMigrations1_create_msmt_resultsSql = []byte( var _bindataDataMigrations1createmsmtresultssql = []byte(
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x93\x4f\x6f\xf2\x30\x0c\xc6\xef\xfd\x14\x3e\x82\xde\x97\xc3\x26\x71" + "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x93\x4f\x6f\xf2\x30\x0c\xc6\xef\xfd\x14\x3e\x82\xde\x97\xc3\x26\x71" +
"\xe2\x14\x5a\x6f\xeb\x56\x52\x94\xa6\xd3\x38\xb5\xd1\x1a\x50\x34\x9a\x56\x69\x22\xb4\x6f\x3f\x85\x7f\x2a\xac\x70" + "\xe2\x14\x5a\x6f\xeb\x56\x52\x94\xa6\xd3\x38\xb5\xd1\x1a\x50\x34\x9a\x56\x69\x22\xb4\x6f\x3f\x85\x7f\x2a\xac\x70" +
"\xde\xd5\xbf\xc7\x8e\xfd\xd8\x99\x4c\xe0\x5f\xad\x36\x46\x58\x09\x51\xb3\xd3\x41\x3f\x90\x59\x61\x65\x2d\xb5\x9d" + "\xde\xd5\xbf\xc7\x8e\xfd\xd8\x99\x4c\xe0\x5f\xad\x36\x46\x58\x09\x51\xb3\xd3\x41\x3f\x90\x59\x61\x65\x2d\xb5\x9d" +
@ -132,27 +144,40 @@ var _dataMigrations1_create_msmt_resultsSql = []byte(
"\xf0\x09\x19\xd2\x10\xb3\xfe\x29\xfb\x25\x8e\x21\xa5\x10\x61\x82\x1c\x21\x43\x0e\x34\x4f\x12\x1f\xca\x97\xde\x77" + "\xf0\x09\x19\xd2\x10\xb3\xfe\x29\xfb\x25\x8e\x21\xa5\x10\x61\x82\x1c\x21\x43\x0e\x34\x4f\x12\x1f\xca\x97\xde\x77" +
"\x08\x49\x16\x92\x08\xf7\x57\x71\xf3\x5b\xfd\x04\x00\x00\xff\xff\xc4\x16\x0a\x20\xcf\x03\x00\x00") "\x08\x49\x16\x92\x08\xf7\x57\x71\xf3\x5b\xfd\x04\x00\x00\xff\xff\xc4\x16\x0a\x20\xcf\x03\x00\x00")
func dataMigrations1_create_msmt_resultsSqlBytes() ([]byte, error) { func bindataDataMigrations1createmsmtresultssqlBytes() ([]byte, error) {
return bindataRead( return bindataRead(
_dataMigrations1_create_msmt_resultsSql, _bindataDataMigrations1createmsmtresultssql,
"data/migrations/1_create_msmt_results.sql", "data/migrations/1_create_msmt_results.sql",
) )
} }
func dataMigrations1_create_msmt_resultsSql() (*asset, error) {
bytes, err := dataMigrations1_create_msmt_resultsSqlBytes()
func bindataDataMigrations1createmsmtresultssql() (*asset, error) {
bytes, err := bindataDataMigrations1createmsmtresultssqlBytes()
if err != nil { if err != nil {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "data/migrations/1_create_msmt_results.sql", size: 0, md5checksum: "", mode: os.FileMode(0), modTime: time.Unix(0, 0)} info := bindataFileInfo{
name: "data/migrations/1_create_msmt_results.sql",
size: 0,
md5checksum: "",
mode: os.FileMode(0),
modTime: time.Unix(0, 0),
}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
//
// Asset loads and returns the asset for the given name. // Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or // It returns an error if the asset could not be found or
// could not be loaded. // could not be loaded.
//
func Asset(name string) ([]byte, error) { func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1) cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok { if f, ok := _bindata[cannonicalName]; ok {
@ -165,9 +190,11 @@ func Asset(name string) ([]byte, error) {
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist} return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
} }
//
// MustAsset is like Asset but panics when Asset would return an error. // MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables. // It simplifies safe initialization of global variables.
// nolint: deadcode // nolint: deadcode
//
func MustAsset(name string) []byte { func MustAsset(name string) []byte {
a, err := Asset(name) a, err := Asset(name)
if err != nil { if err != nil {
@ -177,9 +204,10 @@ func MustAsset(name string) []byte {
return a return a
} }
//
// AssetInfo loads and returns the asset info for the given name. // AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or // It returns an error if the asset could not be found or could not be loaded.
// could not be loaded. //
func AssetInfo(name string) (os.FileInfo, error) { func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1) cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok { if f, ok := _bindata[cannonicalName]; ok {
@ -192,8 +220,10 @@ func AssetInfo(name string) (os.FileInfo, error) {
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist} return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
} }
//
// AssetNames returns the names of the assets. // AssetNames returns the names of the assets.
// nolint: deadcode // nolint: deadcode
//
func AssetNames() []string { func AssetNames() []string {
names := make([]string, 0, len(_bindata)) names := make([]string, 0, len(_bindata))
for name := range _bindata { for name := range _bindata {
@ -202,12 +232,15 @@ func AssetNames() []string {
return names return names
} }
//
// _bindata is a table, holding each asset generator, mapped to its name. // _bindata is a table, holding each asset generator, mapped to its name.
//
var _bindata = map[string]func() (*asset, error){ var _bindata = map[string]func() (*asset, error){
"data/default-config.json": dataDefaultConfigJson, "data/default-config.json": bindataDataDefaultconfigjson,
"data/migrations/1_create_msmt_results.sql": dataMigrations1_create_msmt_resultsSql, "data/migrations/1_create_msmt_results.sql": bindataDataMigrations1createmsmtresultssql,
} }
//
// AssetDir returns the file names below a certain // AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata. // directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the // For example if you run go-bindata on data/... and data contains the
@ -221,6 +254,7 @@ var _bindata = map[string]func() (*asset, error){
// AssetDir("data/img") would return []string{"a.png", "b.png"} // AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error // AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}. // AssetDir("") will return []string{"data"}.
//
func AssetDir(name string) ([]string, error) { func AssetDir(name string) ([]string, error) {
node := _bintree node := _bintree
if len(name) != 0 { if len(name) != 0 {
@ -229,12 +263,20 @@ func AssetDir(name string) ([]string, error) {
for _, p := range pathList { for _, p := range pathList {
node = node.Children[p] node = node.Children[p]
if node == nil { if node == nil {
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist} return nil, &os.PathError{
Op: "open",
Path: name,
Err: os.ErrNotExist,
}
} }
} }
} }
if node.Func != nil { if node.Func != nil {
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist} return nil, &os.PathError{
Op: "open",
Path: name,
Err: os.ErrNotExist,
}
} }
rv := make([]string, 0, len(node.Children)) rv := make([]string, 0, len(node.Children))
for childName := range node.Children { for childName := range node.Children {
@ -243,16 +285,17 @@ func AssetDir(name string) ([]string, error) {
return rv, nil return rv, nil
} }
type bintree struct { type bintree struct {
Func func() (*asset, error) Func func() (*asset, error)
Children map[string]*bintree Children map[string]*bintree
} }
var _bintree = &bintree{nil, map[string]*bintree{ var _bintree = &bintree{Func: nil, Children: map[string]*bintree{
"data": {nil, map[string]*bintree{ "data": {Func: nil, Children: map[string]*bintree{
"default-config.json": {dataDefaultConfigJson, map[string]*bintree{}}, "default-config.json": {Func: bindataDataDefaultconfigjson, Children: map[string]*bintree{}},
"migrations": {nil, map[string]*bintree{ "migrations": {Func: nil, Children: map[string]*bintree{
"1_create_msmt_results.sql": {dataMigrations1_create_msmt_resultsSql, map[string]*bintree{}}, "1_create_msmt_results.sql": {Func: bindataDataMigrations1createmsmtresultssql, Children: map[string]*bintree{}},
}}, }},
}}, }},
}} }}