diff --git a/README.md b/README.md index bd0154b..a8fbe3e 100644 --- a/README.md +++ b/README.md @@ -568,5 +568,5 @@ go get -d github.com/sipt/shuttle cd $GOPATH/src/github.com/sipt/shuttle/assets go generate # package html and GeoLite2-Country.mmdb resources into assets/assets.go cd $GOPATH/src/github.com/sipt/shuttle/cmd -go build +go build -tags release ``` \ No newline at end of file diff --git a/README_zh.md b/README_zh.md index b3c4c57..74c02f5 100644 --- a/README_zh.md +++ b/README_zh.md @@ -594,5 +594,5 @@ go get -d github.com/sipt/shuttle cd $GOPATH/src/github.com/sipt/shuttle/assets go generate # 打包HTML和GeoLite2-Country.mmdb到assets/assets.go文件 cd $GOPATH/src/github.com/sipt/shuttle/cmd -go build +go build -tags release ``` \ No newline at end of file diff --git a/assets/assets_generate.go b/assets/assets_generate.go index 7c0f8a5..41b3403 100644 --- a/assets/assets_generate.go +++ b/assets/assets_generate.go @@ -1,3 +1,20 @@ +// +build !release //go:generate go run github.com/UnnoTed/fileb0x b0x.yaml package assets + +import ( + "io/ioutil" + "net/http" +) + +var HTTP http.FileSystem = http.Dir("./") + +// ReadFile is adapTed from ioutil +func ReadFile(path string) ([]byte, error) { + f, err := HTTP.Open(path) + if err != nil { + return nil, err + } + return ioutil.ReadAll(f) +} diff --git a/assets/b0x.yaml b/assets/b0x.yaml index 1dc08ee..7922229 100644 --- a/assets/b0x.yaml +++ b/assets/b0x.yaml @@ -13,7 +13,7 @@ dest: "." fmt: true # build tags for the main b0x.go file -tags: "" +tags: "release" # updater allows you to update a b0x in a running server # without having to restart it