accessor

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2021 License: MIT Imports: 8 Imported by: 0

README

go-embedding-accessor Actions Status

An accessor generator for files embedded with go:embed.

Usage

  1. Install go-embedding-accessor.
  2. Run go-embedding-accessor command at your repository.
$ go-embedding-accessor --pkg PACKAGE_NAME --files 'assets/*.txt' --name asset

You can find asset_embedding.go in your repository. So, your Go program get {show,list,restore}-{name} options. In the following, the option name generated when "asset" is specified as name is used.

List embedding files

list-asset list your embedding files.

$ my-app --list-asset
assets/a.txt
assets/b.txt
Show embedding file

show-asset show embedding file.

$ my-app --show-asset assets/a.txt
Contents of a.txt
Restore embedding files

restore-assets restore embedding files.

$ my-app --restore-asset

You also specify output path by --restore-path option.

Generated code dependency

Generated code (asset_embedding.go) doesn't depend on your code, only provides {show,list,restore}-asset options at init() function.

Installation

$ go install github.com/monochromegane/go-embedding-accessor/cmd/go-embedding-accessor@latest

Contribution

  1. Fork it
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create new Pull Request

License

MIT

Author

monochromegane

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(pkg, outputDir, name, files string) error

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL