diff --git a/Makefile b/Makefile index a002658d1c..94710b7085 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,8 @@ UTILS := \ # # This target sets up the dependencies to correctly build all go commands. # Other targets must depend on this target to correctly builds CMDS. -all: vendor node_modules $(UTILS) subdirs $(CMDS) +all: GO_ARGS=-tags 'assets $(GO_TAGS)' +all: vendor node_modules $(UTILS) subdirs generate $(CMDS) # Target to build subdirs. # Each subdirs must support the `all` target. @@ -109,11 +110,10 @@ vendor/github.com/kevinburke/go-bindata/go-bindata/main.go: vendor fmt: $(SOURCES_NO_VENDOR) goimports -w $^ -# generate: - # TODO: re-enable these after we decide on a strategy for building without running `go generate`. - # $(GO_GENERATE) ./chronograf/dist/... - # $(GO_GENERATE) ./chronograf/server/... - # $(GO_GENERATE) ./chronograf/canned/... +generate: + $(GO_GENERATE) ./chronograf/dist/... + $(GO_GENERATE) ./chronograf/server/... + $(GO_GENERATE) ./chronograf/canned/... test-js: node_modules cd chronograf/ui && yarn test --runInBand diff --git a/chronograf/canned/TODO.go b/chronograf/canned/TODO.go index 3bfcd28e29..be35a0332b 100644 --- a/chronograf/canned/TODO.go +++ b/chronograf/canned/TODO.go @@ -1,16 +1,18 @@ +// +build !assets + package canned import "errors" -// The functions defined in this file are placeholders -// until we decide how to get the finalized Chronograf assets in platform. - -var errTODO = errors.New("TODO: decide how to handle chronograf assets in platform") +// The functions defined in this file are placeholders when the binary is compiled +// without assets. +// Asset returns an error stating no assets were included in the binary. func Asset(string) ([]byte, error) { - return nil, errTODO + return nil, errors.New("no assets included in binary") } +// AssetNames returns nil because there are no assets included in the binary. func AssetNames() []string { return nil -} \ No newline at end of file +} diff --git a/chronograf/canned/bin.go b/chronograf/canned/bin.go index 24c1d10478..14224a6613 100644 --- a/chronograf/canned/bin.go +++ b/chronograf/canned/bin.go @@ -8,7 +8,7 @@ import ( "github.com/influxdata/platform/chronograf" ) -//go:generate go-bindata -o bin_gen.go -ignore README|apps|.sh|go -pkg canned . +//go:generate go-bindata -o bin_gen.go -tags assets -ignore README|apps|.sh|go -pkg canned . // BinLayoutsStore represents a layout store using data generated by go-bindata type BinLayoutsStore struct { diff --git a/chronograf/dist/TODO.go b/chronograf/dist/TODO.go index 791a96bbe5..0465bc8465 100644 --- a/chronograf/dist/TODO.go +++ b/chronograf/dist/TODO.go @@ -1,3 +1,5 @@ +// +build !assets + package dist import ( @@ -6,18 +8,21 @@ import ( ) // The functions defined in this file are placeholders -// until we decide how to get the finalized Chronograf assets in platform. +// when the binary is compiled without assets. -var errTODO = errors.New("TODO: decide how to handle chronograf assets in platform") +var errNoAssets = errors.New("no assets included in binary") +// Asset returns an error stating no assets were included in the binary. func Asset(string) ([]byte, error) { - return nil, errTODO + return nil, errNoAssets } +// AssetInfo returns an error stating no assets were included in the binary. func AssetInfo(name string) (os.FileInfo, error) { - return nil, errTODO + return nil, errNoAssets } +// AssetDir returns nil because there are no assets included in the binary. func AssetDir(name string) ([]string, error) { - return nil, errTODO -} \ No newline at end of file + return nil, errNoAssets +} diff --git a/chronograf/dist/dist.go b/chronograf/dist/dist.go index ba3d3c938f..6ee460f9a7 100644 --- a/chronograf/dist/dist.go +++ b/chronograf/dist/dist.go @@ -1,6 +1,6 @@ package dist -//go:generate go-bindata -o dist_gen.go -ignore 'map|go' -pkg dist ../ui/build/... +//go:generate go-bindata -o dist_gen.go -ignore 'map|go' -tags assets -pkg dist ../ui/build/... import ( "fmt" diff --git a/chronograf/server/TODO.go b/chronograf/server/TODO.go index b3d050d2a3..242f0f8e47 100644 --- a/chronograf/server/TODO.go +++ b/chronograf/server/TODO.go @@ -1,14 +1,15 @@ +// +build !assets + package server import ( "errors" ) -// The functions defined in this file are placeholders -// until we decide how to get the finalized Chronograf assets in platform. - -var errTODO = errors.New("You didn't generate assets for the chronograf/server folder, using placeholders") +// The functions defined in this file are placeholders when the binary is compiled +// without assets. +// Asset returns an error stating no assets were included in the binary. func Asset(string) ([]byte, error) { - return nil, errTODO + return nil, errors.New("no assets included in binary") } diff --git a/chronograf/server/swagger.go b/chronograf/server/swagger.go index 2308fc7f26..cdae989be7 100644 --- a/chronograf/server/swagger.go +++ b/chronograf/server/swagger.go @@ -1,6 +1,6 @@ package server -//go:generate go-bindata -o swagger_gen.go -ignore go -nocompress -pkg server . +//go:generate go-bindata -o swagger_gen.go -tags assets -ignore go -nocompress -pkg server . import "net/http"