vendor: Mega update all dependencies

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4080
This commit is contained in:
Jakob Borg
2017-04-05 14:34:41 +00:00
parent 49c1527724
commit a1bcc15458
1354 changed files with 55066 additions and 797850 deletions

View File

@@ -10,10 +10,11 @@ import (
)
func BuildGenerateCommand() *Command {
var agouti, noDot bool
var agouti, noDot, internal bool
flagSet := flag.NewFlagSet("generate", flag.ExitOnError)
flagSet.BoolVar(&agouti, "agouti", false, "If set, generate will generate a test file for writing Agouti tests")
flagSet.BoolVar(&noDot, "nodot", false, "If set, generate will generate a test file that does not . import ginkgo and gomega")
flagSet.BoolVar(&internal, "internal", false, "If set, generate will generate a test file that uses the regular package name")
return &Command{
Name: "generate",
@@ -25,15 +26,15 @@ func BuildGenerateCommand() *Command {
"Accepts the following flags:",
},
Command: func(args []string, additionalArgs []string) {
generateSpec(args, agouti, noDot)
generateSpec(args, agouti, noDot, internal)
},
}
}
var specText = `package {{.Package}}_test
var specText = `package {{.Package}}
import (
. "{{.PackageImportPath}}"
{{if .DotImportPackage}}. "{{.PackageImportPath}}"{{end}}
{{if .IncludeImports}}. "github.com/onsi/ginkgo"{{end}}
{{if .IncludeImports}}. "github.com/onsi/gomega"{{end}}
@@ -47,7 +48,7 @@ var _ = Describe("{{.Subject}}", func() {
var agoutiSpecText = `package {{.Package}}_test
import (
. "{{.PackageImportPath}}"
{{if .DotImportPackage}}. "{{.PackageImportPath}}"{{end}}
{{if .IncludeImports}}. "github.com/onsi/ginkgo"{{end}}
{{if .IncludeImports}}. "github.com/onsi/gomega"{{end}}
@@ -75,11 +76,12 @@ type specData struct {
Subject string
PackageImportPath string
IncludeImports bool
DotImportPackage bool
}
func generateSpec(args []string, agouti, noDot bool) {
func generateSpec(args []string, agouti, noDot, internal bool) {
if len(args) == 0 {
err := generateSpecForSubject("", agouti, noDot)
err := generateSpecForSubject("", agouti, noDot, internal)
if err != nil {
fmt.Println(err.Error())
fmt.Println("")
@@ -91,7 +93,7 @@ func generateSpec(args []string, agouti, noDot bool) {
var failed bool
for _, arg := range args {
err := generateSpecForSubject(arg, agouti, noDot)
err := generateSpecForSubject(arg, agouti, noDot, internal)
if err != nil {
failed = true
fmt.Println(err.Error())
@@ -103,7 +105,7 @@ func generateSpec(args []string, agouti, noDot bool) {
}
}
func generateSpecForSubject(subject string, agouti, noDot bool) error {
func generateSpecForSubject(subject string, agouti, noDot, internal bool) error {
packageName, specFilePrefix, formattedName := getPackageAndFormattedName()
if subject != "" {
subject = strings.Split(subject, ".go")[0]
@@ -113,10 +115,11 @@ func generateSpecForSubject(subject string, agouti, noDot bool) error {
}
data := specData{
Package: packageName,
Package: determinePackageName(packageName, internal),
Subject: formattedName,
PackageImportPath: getPackageImportPath(),
IncludeImports: !noDot,
DotImportPackage: !internal,
}
targetFile := fmt.Sprintf("%s_test.go", specFilePrefix)