summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2021-01-30 11:13:29 +0200
committerEyal Posener <[email protected]>2021-01-30 11:13:29 +0200
commit5d9f7f10f0af6142dc2f3b8733b807ed207f9ea7 (patch)
tree59d85c24066392635c458aff573dfeef53673298
parent246bd25c47871a148cf3eec2ba4b1ba0ec5809ad (diff)
Fix failing go1.16 test
Fixes #132
-rw-r--r--go.mod1
-rw-r--r--go.sum2
-rw-r--r--gocomplete/complete.go78
-rw-r--r--gocomplete/tests_test.go2
4 files changed, 44 insertions, 39 deletions
diff --git a/go.mod b/go.mod
index 763ee48..3028d64 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,7 @@
module github.com/posener/complete/v2
require (
+ bou.ke/monkey v1.0.2
github.com/hashicorp/go-multierror v1.0.0
github.com/posener/autogen v0.0.2
github.com/posener/script v1.1.5
diff --git a/go.sum b/go.sum
index 2a45bbb..75f2db1 100644
--- a/go.sum
+++ b/go.sum
@@ -1,3 +1,5 @@
+bou.ke/monkey v1.0.2 h1:kWcnsrCNUatbxncxR/ThdYqbytgOIArtYWqcQLQzKLI=
+bou.ke/monkey v1.0.2/go.mod h1:OqickVX3tNx6t33n1xvtTtu85YN5s6cKwVug+oHMaIA=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
diff --git a/gocomplete/complete.go b/gocomplete/complete.go
index 2cf4227..753a38e 100644
--- a/gocomplete/complete.go
+++ b/gocomplete/complete.go
@@ -536,14 +536,14 @@ func main() {
modHelp := &complete.Command{
Sub: map[string]*complete.Command{
- "download": &complete.Command{},
- "edit": &complete.Command{},
- "graph": &complete.Command{},
- "init": &complete.Command{},
- "tidy": &complete.Command{},
- "vendor": &complete.Command{},
- "verify": &complete.Command{},
- "why": &complete.Command{},
+ "download": {},
+ "edit": {},
+ "graph": {},
+ "init": {},
+ "tidy": {},
+ "vendor": {},
+ "verify": {},
+ "why": {},
},
}
@@ -563,38 +563,38 @@ func main() {
help := &complete.Command{
Sub: map[string]*complete.Command{
- "bug": &complete.Command{},
- "build": &complete.Command{},
- "clean": &complete.Command{},
- "doc": &complete.Command{},
- "env": &complete.Command{},
- "fix": &complete.Command{},
- "fmt": &complete.Command{},
- "generate": &complete.Command{},
- "get": &complete.Command{},
- "install": &complete.Command{},
- "list": &complete.Command{},
+ "bug": {},
+ "build": {},
+ "clean": {},
+ "doc": {},
+ "env": {},
+ "fix": {},
+ "fmt": {},
+ "generate": {},
+ "get": {},
+ "install": {},
+ "list": {},
"mod": modHelp,
- "run": &complete.Command{},
- "test": &complete.Command{},
- "tool": &complete.Command{},
- "version": &complete.Command{},
- "vet": &complete.Command{},
- "buildmode": &complete.Command{},
- "c": &complete.Command{},
- "cache": &complete.Command{},
- "environment": &complete.Command{},
- "filetype": &complete.Command{},
- "go.mod": &complete.Command{},
- "gopath": &complete.Command{},
- "gopath-get": &complete.Command{},
- "goproxy": &complete.Command{},
- "importpath": &complete.Command{},
- "modules": &complete.Command{},
- "module-get": &complete.Command{},
- "packages": &complete.Command{},
- "testflag": &complete.Command{},
- "testfunc": &complete.Command{},
+ "run": {},
+ "test": {},
+ "tool": {},
+ "version": {},
+ "vet": {},
+ "buildmode": {},
+ "c": {},
+ "cache": {},
+ "environment": {},
+ "filetype": {},
+ "go.mod": {},
+ "gopath": {},
+ "gopath-get": {},
+ "goproxy": {},
+ "importpath": {},
+ "modules": {},
+ "module-get": {},
+ "packages": {},
+ "testflag": {},
+ "testfunc": {},
},
}
diff --git a/gocomplete/tests_test.go b/gocomplete/tests_test.go
index b5f96dc..750147a 100644
--- a/gocomplete/tests_test.go
+++ b/gocomplete/tests_test.go
@@ -5,6 +5,7 @@ import (
"sort"
"testing"
+ "bou.ke/monkey"
"github.com/posener/complete/v2"
)
@@ -42,6 +43,7 @@ func TestPredictions(t *testing.T) {
func BenchmarkFake(b *testing.B) {}
func Example() {
+ monkey.Patch(os.Exit, func(int) {})
os.Setenv("COMP_LINE", "go ru")
os.Setenv("COMP_POINT", "5")
main()