An sample of using embedded files in Go.
# with makefile (recommended)
make
# with commands
cd data && go generate -tags dev && cd -
go build
# makefile
make clean
# or
go clean
rm -f data/assets_vfsdata.go
Using -ldflags
:
go build -ldflags '-X main.version=1.0'
Run ./vfsgen-sample
after building, then open http://localhost:7070 in your brower to check the served embedded files.
Also view the console log to check whether reading files from vfsgen
is okay.