diff --git a/.travis.yml b/.travis.yml index 3811479..9c7fcbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,18 @@ language: go go: -- 1.6 +- 1.8 - 1.7 - tip - sudo: false -install: -- go get github.com/gordonklaus/ineffassign -- go get github.com/golang/lint/golint -- go get -t ./... +install: make setup + +script: make check test -script: -- "! gofmt -s -d . 2>&1 | read" -- go test -v ./... -- go vet -- ineffassign . -- golint . +deploy: + provider: releases + api_key: + secure: D2fwuS7n54ZkjfRmLMEAnwR2lQLa5xd+4s0l65pI6UN4ljVfQwQiFdZXaZWFr8PYSTKTm0UPj6Iqqw7VOl8I6iDzcaOqN3hoh5mDaJ7kyo7GZRPodwK9MKdOp5dPw459L2Atll8kxb4iYmfnjmcl0lDCUuWvMxXx+zgiFTB7BO0= + skip_cleanup: true + on: + tags: true diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ddb334d --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +test: + go test -v ./... + +check: lint vet fmtcheck ineffassign + +lint: + golint -set_exit_status . + +vet: + go vet + +fmtcheck: + @ export output="$$(gofmt -s -d .)"; \ + [ -n "$${output}" ] && echo "$${output}" && export status=1; \ + exit $${status:-0} + +ineffassign: + ineffassign . + +setup: + go get github.com/gordonklaus/ineffassign + go get github.com/golang/lint/golint + go get -t -u ./... + +.PHONY: test check lint vet fmtcheck ineffassign diff --git a/cli.go b/cli.go index ab331f1..7992645 100644 --- a/cli.go +++ b/cli.go @@ -103,11 +103,9 @@ func (cli *Cli) Run(args []string) error { } /* -ActionCommand(myFun) is syntactic sugar for -func(cmd *cli.Cmd) { cmd.Action = myFun } +ActionCommand is a convenience function to configure a command with an action. -cmd.CommandAction(_, _, myFun } is syntactic sugar for -cmd.Command(_, _, func(cmd *cli.Cmd) { cmd.Action = myFun }) +cmd.ActionCommand(_, _, myFun } is equivalent to cmd.Command(_, _, func(cmd *cli.Cmd) { cmd.Action = myFun }) */ func ActionCommand(action func()) CmdInitializer { return func(cmd *Cmd) { diff --git a/values_test.go b/values_test.go index 7cdf821..be7f5fd 100644 --- a/values_test.go +++ b/values_test.go @@ -31,7 +31,7 @@ func TestBoolParam(t *testing.T) { err := param.Set(cas.input) if cas.err { - require.Error(t, err, "value %q should have returned an error", cas.input) + require.Errorf(t, err, "value %q should have returned an error", cas.input) continue } @@ -89,7 +89,7 @@ func TestIntParam(t *testing.T) { err := param.Set(cas.input) if cas.err { - require.Error(t, err, "value %q should have returned an error", cas.input) + require.Errorf(t, err, "value %q should have returned an error", cas.input) continue }