go-code-embedding
A tool to embed Go source code into binary using go:embed.
Usage
- 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-codes
list your code.
$ my-app --list-codes
app.go
my-app/main.go
Show code
show-code
show your code.
$ my-app --show-code my-app/main.go
package main
func main() {
my-app.Do()
}
Restore code
restore-codes
restore your code.
$ my-app --restore-codes
You also specify output path by --restore-path
option.
Generated code dependency
Generated code (code_embedding.go
) doesn't depend on your code, only provides {show,list,restore}-code options at init() function.
Installation
$ go install github.com/monochromegane/go-code-embedding/cmd/go-code-embedding@latest
Contribution
- 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
License
MIT
Author
monochromegane