Goblet
library and cmd tool-set for managment assets like go-bindata or go-assets.
Install / Use
/learn @deadcheat/GobletREADME
goblet
library and cmd tools set for managment assets like go-bindata or go-assets
install
To use asset builder, get all packages.
go get -u github.com/deadcheat/goblet/...
To only use generated file, get single package
go get -u github.com/deadcheat/goblet
How to use
Simply create asset from a directory
goblet /pass/to/your/assets
Create asset with go:generate comment
goblet -g /pass/to/your/assets
Name different package name and output different directory
goblet -p mypackage -o ./mypackage /pass/to/your/assets
Help Command
On command-line, goblet acts as asset builder like as go-assets-builder or go-bindata
NAME:
goblet - make a binary contain some assets
USAGE:
goblet [global options] command [command options] [arguments...]
VERSION:
1.3.0
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--expression value, -e value Regular expressions you want files to contain
--generate, -g If set, generate go:generate line to outputfile
--ignore-dotfiles If set, ignore dotfiles(i.e. '.gitkeep')
--exclude-empty-dir If set, ignore dotfiles(i.e. '.gitkeep')
--name value, -n value Variable name for output assets (default: "Assets")
--out value, -o value Output file name, result will be displaed to standard-out when it's skipped
--package value, -p value Package name for output (default: "main")
--help, -h show help
--version, -v print the version
Examples
see example repo dir for full of codes.
http static file
Generated asset is generated as implementation of http.FileSystem
http.Handle("/", http.FileServer(assetsbin.Assets))
log.Println("start server localhost:3000")
if err := http.ListenAndServe(":3000", nil); err != nil {
log.Fatal(err)
}
Sometimes we changed root on http request from "/" such as "/statics/",
goblet.FileSystem has WithPrefix func.
http.Handle("/static/", http.FileServer(assetsbin.Assets.WithPrefix("/static/")))
log.Println("start server localhost:3000")
if err := http.ListenAndServe(":3000", nil); err != nil {
log.Fatal(err)
}
reading config file with config library like github.com/spf13/viper
goblet.File has bytes.Reader, so you can use goblet.File directly
viper.SetConfigType("toml")
f, _ := configbin.Assets.File("/config/configfile.toml")
viper.ReadConfig(f)
var s Server
_ = viper.UnmarshalKey("server", &s)
Related Skills
node-connect
337.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.3kCommit, push, and open a PR
