travis: Bump to golang 1.10

This requires breaking changes in gofmt. It is hilarious that this was
changed. Oh well. This also moves to the latest stable etcd. Lastly,
this changes the `go vet` testing to test by package, since the new go
vet changed how it works and now fails without this change.
This commit is contained in:
James Shubin
2018-05-06 16:19:21 -04:00
parent 56db31ca43
commit d990d2ad86
12 changed files with 35 additions and 59 deletions

View File

@@ -2,8 +2,8 @@ language: go
os: os:
- linux - linux
go: go:
- 1.9.x
- 1.10.x - 1.10.x
- 1.11.x
- tip - tip
go_import_path: github.com/purpleidea/mgmt go_import_path: github.com/purpleidea/mgmt
sudo: true sudo: true
@@ -26,13 +26,13 @@ script: 'make test'
matrix: matrix:
fast_finish: false fast_finish: false
allow_failures: allow_failures:
- go: 1.10.x - go: 1.11.x
- go: tip - go: tip
- os: osx - os: osx
# include only one build for osx for a quicker build as the nr. of these runners are sparse # include only one build for osx for a quicker build as the nr. of these runners are sparse
include: include:
- os: osx - os: osx
go: 1.9.x go: 1.10.x
# the "secure" channel value is the result of running: ./misc/travis-encrypt.sh # the "secure" channel value is the result of running: ./misc/travis-encrypt.sh
# with a value of: irc.freenode.net#mgmtconfig to eliminate noise from forks... # with a value of: irc.freenode.net#mgmtconfig to eliminate noise from forks...

View File

@@ -13,7 +13,7 @@ Once you're familiar with the general idea, please start hacking...
### Installing golang ### Installing golang
* You need golang version 1.9 or greater installed. * You need golang version 1.10 or greater installed.
* To install on rpm style systems: `sudo dnf install golang` * To install on rpm style systems: `sudo dnf install golang`
* To install on apt style systems: `sudo apt install golang` * To install on apt style systems: `sudo apt install golang`
* To install on macOS systems install [Homebrew](https://brew.sh) * To install on macOS systems install [Homebrew](https://brew.sh)
@@ -89,7 +89,7 @@ required for running the _test_ suite.
### Build ### Build
* `golang` 1.9 or higher (required, available in some distros and distributed * `golang` 1.10 or higher (required, available in some distros and distributed
as a binary officially by [golang.org](https://golang.org/dl/)) as a binary officially by [golang.org](https://golang.org/dl/))
### Runtime ### Runtime

View File

@@ -60,9 +60,7 @@ func (obj *MyGAPI) Cli(c *cli.Context, fs engine.Fs) (*gapi.Deploy, error) {
Name: obj.Name, Name: obj.Name,
Noop: c.GlobalBool("noop"), Noop: c.GlobalBool("noop"),
Sema: c.GlobalInt("sema"), Sema: c.GlobalInt("sema"),
GAPI: &MyGAPI{ GAPI: &MyGAPI{},
// TODO: add properties here...
},
}, nil }, nil
} }
return nil, nil // we weren't activated! return nil, nil // we weren't activated!

View File

@@ -65,9 +65,7 @@ func (obj *MyGAPI) Cli(c *cli.Context, fs engine.Fs) (*gapi.Deploy, error) {
Name: obj.Name, Name: obj.Name,
Noop: c.GlobalBool("noop"), Noop: c.GlobalBool("noop"),
Sema: c.GlobalInt("sema"), Sema: c.GlobalInt("sema"),
GAPI: &MyGAPI{ GAPI: &MyGAPI{},
// TODO: add properties here...
},
}, nil }, nil
} }
return nil, nil // we weren't activated! return nil, nil // we weren't activated!

View File

@@ -60,9 +60,7 @@ func (obj *MyGAPI) Cli(c *cli.Context, fs engine.Fs) (*gapi.Deploy, error) {
Name: obj.Name, Name: obj.Name,
Noop: c.GlobalBool("noop"), Noop: c.GlobalBool("noop"),
Sema: c.GlobalInt("sema"), Sema: c.GlobalInt("sema"),
GAPI: &MyGAPI{ GAPI: &MyGAPI{},
// TODO: add properties here...
},
}, nil }, nil
} }
return nil, nil // we weren't activated! return nil, nil // we weren't activated!

View File

@@ -62,9 +62,7 @@ func (obj *MyGAPI) Cli(c *cli.Context, fs engine.Fs) (*gapi.Deploy, error) {
Name: obj.Name, Name: obj.Name,
Noop: c.GlobalBool("noop"), Noop: c.GlobalBool("noop"),
Sema: c.GlobalInt("sema"), Sema: c.GlobalInt("sema"),
GAPI: &MyGAPI{ GAPI: &MyGAPI{},
// TODO: add properties here...
},
}, nil }, nil
} }
return nil, nil // we weren't activated! return nil, nil // we weren't activated!

View File

@@ -60,9 +60,7 @@ func (obj *MyGAPI) Cli(c *cli.Context, fs engine.Fs) (*gapi.Deploy, error) {
Name: obj.Name, Name: obj.Name,
Noop: c.GlobalBool("noop"), Noop: c.GlobalBool("noop"),
Sema: c.GlobalInt("sema"), Sema: c.GlobalInt("sema"),
GAPI: &MyGAPI{ GAPI: &MyGAPI{},
// TODO: add properties here...
},
}, nil }, nil
} }
return nil, nil // we weren't activated! return nil, nil // we weren't activated!

View File

@@ -170,19 +170,19 @@ func (obj *TemplateFunc) run(templateText string, vars types.Value) (string, err
// see: https://golang.org/pkg/text/template/#FuncMap for more info // see: https://golang.org/pkg/text/template/#FuncMap for more info
// note: we can override any other functions by adding them here... // note: we can override any other functions by adding them here...
funcMap := map[string]interface{}{ funcMap := map[string]interface{}{
//"test1": func(in interface{}) (interface{}, error) { // ok //"test1": func(in interface{}) (interface{}, error) { // ok
// return fmt.Sprintf("got(%T): %+v", in, in), nil // return fmt.Sprintf("got(%T): %+v", in, in), nil
//}, //},
//"test2": func(in interface{}) interface{} { // NOT ok //"test2": func(in interface{}) interface{} { // NOT ok
// panic("panic") // a panic here brings down everything! // panic("panic") // a panic here brings down everything!
//}, //},
//"test3": func(foo int64) (string, error) { // ok, but errors //"test3": func(foo int64) (string, error) { // ok, but errors
// return "", fmt.Errorf("i am an error") // return "", fmt.Errorf("i am an error")
//}, //},
//"test4": func(in1, in2 reflect.Value) (reflect.Value, error) { // ok //"test4": func(in1, in2 reflect.Value) (reflect.Value, error) { // ok
// s := fmt.Sprintf("got: %+v and: %+v", in1, in2) // s := fmt.Sprintf("got: %+v and: %+v", in1, in2)
// return reflect.ValueOf(s), nil // return reflect.ValueOf(s), nil
//}, //},
} }
// FIXME: should we do this once in init() instead, or in the Register // FIXME: should we do this once in init() instead, or in the Register

View File

@@ -1722,10 +1722,10 @@ func (obj *ExprStr) String() string { return fmt.Sprintf("str(%s)", obj.V) }
// itself. // itself.
func (obj *ExprStr) Interpolate() (interfaces.Expr, error) { func (obj *ExprStr) Interpolate() (interfaces.Expr, error) {
pos := &Pos{ pos := &Pos{
// column/line number, starting at 1 // column/line number, starting at 1
//Column: -1, // TODO //Column: -1, // TODO
//Line: -1, // TODO //Line: -1, // TODO
//Filename: "", // optional source filename, if known //Filename: "", // optional source filename, if known
} }
result, err := InterpolateStr(obj.V, pos) result, err := InterpolateStr(obj.V, pos)
if err != nil { if err != nil {

View File

@@ -11,12 +11,6 @@ ROOT=$(dirname "${BASH_SOURCE}")/..
cd "${ROOT}" cd "${ROOT}"
. test/util.sh . test/util.sh
#GO_VERSION=($(go version))
#
#if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3|go1.4|go1.5|go1.6|go1.7|go1.8|go1.9|devel') ]]; then
# fail_test "Unknown go version '${GO_VERSION[2]}', failing gofmt."
#fi
find_files() { find_files() {
git ls-files | grep '\.go$' git ls-files | grep '\.go$'
} }

View File

@@ -57,21 +57,13 @@ function consistent-imports() {
fi fi
} }
# loop through directories in an attempt to scan each go package # run go vet on a per-package basis
for dir in `find . -maxdepth 5 -type d -not -path './old/*' -not -path './old' -not -path './tmp/*' -not -path './tmp' -not -path './.*' -not -path './vendor/*'`; do base=$(go list .)
match="$dir/*.go" for pkg in `go list -e ./... | grep -v "^${base}/vendor/" | grep -v "^${base}/examples/" | grep -v "^${base}/test/" | grep -v "^${base}/old" | grep -v "^${base}/old/" | grep -v "^${base}/tmp" | grep -v "^${base}/tmp/"`; do
#echo "match is: $match" echo -e "\tgo vet: $pkg"
if ! ls $match &>/dev/null; then # workaround go vet issues by adding the new -source flag (go1.9+)
#echo "skipping: $match" run-test go vet -source "$pkg" || fail_test "go vet -source did not pass pkg"
continue # no *.go files found
fi
#echo "matching: $match"
if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3|go1.4|go1.5|go1.6|go1.7|go1.8') ]]; then
# workaround go vet issues by adding the new -source flag (go1.9+)
run-test go vet -source "$match" || fail_test "go vet -source did not pass pkg"
else
run-test go vet "$match" || fail_test "go vet did not pass pkg" # since it doesn't output an ok message on pass
fi
done done
# loop through individual *.go files # loop through individual *.go files