-
Notifications
You must be signed in to change notification settings - Fork 159
/
main.go
29 lines (25 loc) · 950 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"bytes"
"flag"
"io/ioutil"
"log"
)
func main() {
// notest
var out = flag.String("output", "./package-names.go", "Output filename to write")
var pkg = flag.String("package", "main", "Package name in generated file")
var name = flag.String("name", "PackageNames", "Name of the variable to define")
var filter = flag.String("filter", ".*", "Regex to filter paths (operates on full path including vendor directory)")
var standard = flag.Bool("standard", false, "Use standard library packages")
var novendor = flag.Bool("novendor", false, "Exclude packages in vendor directories")
var goListPath = flag.String("path", "all", "Path to pass to go list command")
flag.Parse()
buf := &bytes.Buffer{}
if err := hints(buf, *pkg, *name, *goListPath, *filter, *standard, *novendor); err != nil {
log.Fatal(err.Error())
}
if err := ioutil.WriteFile(*out, buf.Bytes(), 0644); err != nil {
log.Fatal(err.Error())
}
}