mirror of https://github.com/markbates/pkger.git
Removed optional tags with one tag, !skippkger
This commit is contained in:
parent
331c57067b
commit
3c88c54d65
|
@ -30,7 +30,6 @@ const outName = "pkged.go"
|
||||||
type packCmd struct {
|
type packCmd struct {
|
||||||
*flag.FlagSet
|
*flag.FlagSet
|
||||||
out string
|
out string
|
||||||
tags string
|
|
||||||
help bool
|
help bool
|
||||||
include slice
|
include slice
|
||||||
subs []command
|
subs []command
|
||||||
|
@ -54,7 +53,7 @@ func (e *packCmd) Exec(args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := Package(info, fp, decls, e.tags); err != nil {
|
if err := Package(info, fp, decls); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +104,6 @@ func New() (*packCmd, error) {
|
||||||
c.FlagSet = flag.NewFlagSet("pkger", flag.ExitOnError)
|
c.FlagSet = flag.NewFlagSet("pkger", flag.ExitOnError)
|
||||||
c.BoolVar(&c.help, "h", false, "prints help information")
|
c.BoolVar(&c.help, "h", false, "prints help information")
|
||||||
c.StringVar(&c.out, "o", "", "output directory for pkged.go")
|
c.StringVar(&c.out, "o", "", "output directory for pkged.go")
|
||||||
c.StringVar(&c.tags, "t", "", "conditional build tag(s) for pkged.go")
|
|
||||||
c.Var(&c.include, "include", "packages the specified file or directory")
|
c.Var(&c.include, "include", "packages the specified file or directory")
|
||||||
c.Usage = func() {
|
c.Usage = func() {
|
||||||
fmt.Fprintf(os.Stderr, "Usage:\n\n")
|
fmt.Fprintf(os.Stderr, "Usage:\n\n")
|
||||||
|
@ -125,7 +123,7 @@ func (e *packCmd) Flags() *flag.FlagSet {
|
||||||
return e.FlagSet
|
return e.FlagSet
|
||||||
}
|
}
|
||||||
|
|
||||||
func Package(info here.Info, out string, decls parser.Decls, tags string) error {
|
func Package(info here.Info, out string, decls parser.Decls) error {
|
||||||
c, err := here.Dir(filepath.Dir(out))
|
c, err := here.Dir(filepath.Dir(out))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -145,9 +143,7 @@ func Package(info here.Info, out string, decls parser.Decls, tags string) error
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
fmt.Fprintf(f, "// Code generated by pkger; DO NOT EDIT.\n\n")
|
fmt.Fprintf(f, "// Code generated by pkger; DO NOT EDIT.\n\n")
|
||||||
if len(tags) > 0 {
|
fmt.Fprintf(f, "// +build !skippkger\n\n")
|
||||||
fmt.Fprintf(f, "// +build %s\n\n", tags)
|
|
||||||
}
|
|
||||||
fmt.Fprintf(f, "package %s\n\n", c.Name)
|
fmt.Fprintf(f, "package %s\n\n", c.Name)
|
||||||
fmt.Fprintf(f, "import (\n\t\"github.com/markbates/pkger\"\n\t")
|
fmt.Fprintf(f, "import (\n\t\"github.com/markbates/pkger\"\n\t")
|
||||||
fmt.Fprintf(f, "\"github.com/markbates/pkger/pkging/mem\"\n)\n\n")
|
fmt.Fprintf(f, "\"github.com/markbates/pkger/pkging/mem\"\n)\n\n")
|
||||||
|
|
Loading…
Reference in New Issue