Usage

  1. $ gf pack -h
  2. USAGE
  3. gf pack SRC DST
  4. ARGUMENT
  5. SRC source path for packing, which can be multiple source paths.
  6. DST destination file path for packed file. if extension of the filename is ".go" and "-n" option is given,
  7. it enables packing SRC to go file, or else it packs SRC into a binary file.
  8. OPTION
  9. -n, --name package name for output go file, it's set as its directory name if no name passed
  10. -p, --prefix prefix for each file packed into the resource file
  11. -k, --keepPath keep the source path from system to resource file, usually for relative path
  12. -h, --help more information about this command
  13. EXAMPLE
  14. gf pack public data.bin
  15. gf pack public,template data.bin
  16. gf pack public,template packed/data.go
  17. gf pack public,template,config packed/data.go
  18. gf pack public,template,config packed/data.go -n=packed -p=/var/www/my-app
  19. gf pack /var/www/public packed/data.go -n=packed

This command is used to package any file into a resource file or a Go code file, allowing any file to be packaged and distributed along with the executable file. Additionally, the build command supports packaging and compiling in one step; please refer to the build command help for details. For an introduction to resource management, please refer to the Resource section.

Examples

  1. $ gf pack public,template packed/data.go
  2. done!
  3. $ ll packed
  4. total 184
  5. -rw-r--r-- 1 john staff 89K Dec 31 00:44 data.go

Further Reading