Added support for build tags with the -tags flag
This commit is contained in:
parent
871202fb0f
commit
f813d1c931
10
README.md
10
README.md
|
@ -161,3 +161,13 @@ package $PACKAGENAME
|
|||
// supplied to go-bindata.
|
||||
var go_bindata = make(map[string] func() []byte)
|
||||
```
|
||||
|
||||
#### Build tags
|
||||
|
||||
With the optional -tags flag, you can specify any go build tags that
|
||||
must be fulfilled for the output file to be included in a build. This
|
||||
is useful for including binary data in multiple formats, where the desired
|
||||
format is specified at build time with the appropriate tag(s).
|
||||
|
||||
The tags are appended to a `// +build` line in the beginning of the output file
|
||||
and must follow the build tags syntax specified by the go tool.
|
||||
|
|
5
main.go
5
main.go
|
@ -24,6 +24,7 @@ var (
|
|||
prefix = flag.String("prefix", "", "Optional path prefix to strip off map keys and function names.")
|
||||
uncompressed = flag.Bool("uncompressed", false, "The specified resource will /not/ be GZIP compressed when this flag is specified. This alters the generated output code.")
|
||||
nomemcopy = flag.Bool("nomemcopy", false, "Use a .rodata hack to get rid of unnecessary memcopies. Refer to the documentation to see what implications this carries.")
|
||||
tags = flag.String("tags", "", "Optional build tags")
|
||||
toc = flag.Bool("toc", false, "Generate a table of contents for this and other files. The input filepath becomes the map key. This option is only useable in non-pipe mode.")
|
||||
version = flag.Bool("version", false, "Display version information.")
|
||||
regFuncName = regexp.MustCompile(`[^a-zA-Z0-9_]`)
|
||||
|
@ -53,6 +54,10 @@ func main() {
|
|||
|
||||
defer fd.Close()
|
||||
|
||||
if *tags != "" {
|
||||
fmt.Fprintf(fd, "// +build %s\n\n", *tags)
|
||||
}
|
||||
|
||||
// Translate binary to Go code.
|
||||
translate(fs, fd, *pkgname, *funcname, *uncompressed, *nomemcopy)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user