A tool to embed Go source code into binary using go:embed. This is a typical use case for monochromegane/go-embedding-accessor.
- Install go-code-embedding.
- Execute
go-code-embedding
command at your repository.
$ go-code-embedding --pkg PACKAGE_NAME
You can find code_embedding.go
in your repository.
So, your Go program get {show,list,restore}-code options.
list-code
list your code.
$ my-app --list-code
app.go
my-app/main.go
show-code
show your code.
$ my-app --show-code my-app/main.go
package main
func main() {
my-app.Do()
}
restore-code
restore your code.
$ my-app --restore-code
You also specify output path by --restore-path
option.
Generated code (code_embedding.go
) doesn't depend on your code, only provides {show,list,restore}-code options at init() function.
$ go install github.com/monochromegane/go-code-embedding/cmd/go-code-embedding@latest
- Fork it
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
go test ./...
command and confirm that it passes - Run
gofmt -s
- Create new Pull Request