The pkgzip command bundles assets into a Go package. https://code.soquee.net/pkgzip/
This repository has been archived on 2022-07-17. You can view files and clone it, but cannot push or open issues/pull-requests.
Go to file
Sam Whited b90d564a44
.github: disable mirroring
Signed-off-by: Sam Whited <sam@samwhited.com>
2022-07-17 06:57:09 -04:00
.github/workflows .github: disable mirroring 2022-07-17 06:57:09 -04:00
.gitignore Initial public release 2019-05-26 10:21:33 -05:00
CONTRIBUTING.md Initial public release 2019-05-26 10:21:33 -05:00
LICENSE Initial public release 2019-05-26 10:21:33 -05:00
LICENSE.apache Initial public release 2019-05-26 10:21:33 -05:00
README.md Minor update to Makefile example in readme 2019-05-29 13:37:04 -05:00
go.mod all: add deprecation message 2021-06-11 17:49:30 -04:00
main.go Initial public release 2019-05-26 10:21:33 -05:00

README.md

pkgzip

The pkgzip command bundles assets into a Go package. It is a fork of statik that changes the API of the package to not require import side effects.

To use this tool in your Go project, add it to your tools.go file, and add a Go Generate line (this doesn't necessarily have to be in tools.go) similar to the one in the following example:

//go:generate go run code.soquee.net/pkgzip -m -f -src assets -pkg assetsfs

// +build tools

package main

import (
	_ "code.soquee.net/pkgzip"
)

Then update your go.mod file with the specific version you want (use go get -u to get the latest), and run go generate tools.go (or wherever you put the comment) to generate your assets package. It's probably easiest to do this from your Makefile like so:

ASSETS!=find myassetstree/

mybin: internal/assetsfs/pkgzip.go
	go build -o $@

internal/assetsfs/pkgzip.go: $(ASSETS)
	go generate tools.go

License

The package may be used under the terms of the BSD 2-Clause License a copy of which may be found in the LICENSE file.

Unless you explicitly state otherwise, any contribution submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.

Parts of this work are copied from statik and used under the terms of the Apache License Version 2.0, a copy of which can be found in the file LICENSE.apache.