Skip to content

Commit

Permalink
chore(*): upgrade docker-go-dev and use new linter (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua-Anderson committed Jul 29, 2016
1 parent 1199b9e commit cc4f07e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 32 deletions.
19 changes: 3 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ endif
BUILD_OS ?=linux darwin windows
BUILD_ARCH ?=amd64 386

DEV_ENV_IMAGE := quay.io/deis/go-dev:0.14.0
DEV_ENV_IMAGE := quay.io/deis/go-dev:0.16.0
DEV_ENV_WORK_DIR := /go/src/${repo_path}
DEV_ENV_PREFIX := docker run --rm -e CGO_ENABLED=0 -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR}
DEV_ENV_PREFIX_CGO_ENABLED := docker run --rm -e CGO_ENABLED=1 -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR}
DEV_ENV_CMD := ${DEV_ENV_PREFIX} ${DEV_ENV_IMAGE}
DIST_DIR := _dist

GO_FILES = $(wildcard *.go)
GO_LDFLAGS = -ldflags "-s -X ${repo_path}/version.BuildVersion=${VERSION}"
GO_PACKAGES = cmd parser cli $(wildcard pkg/*)
GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES))
GOFMT = gofmtresult=$$(gofmt -e -l -s ${GO_FILES} ${GO_PACKAGES}); if [[ -n $$gofmtresult ]]; then echo "gofmt errors found in the following files: $${gofmtresult}"; false; fi;
GOTEST = go test --race -v
GOTEST = go test --race

# The tag of the commit
GIT_TAG := $(shell git tag -l --contains HEAD)
Expand Down Expand Up @@ -82,17 +78,8 @@ installer: build
&& echo 'See http://docs.deis.io/ for documentation.' \
&& echo"

setup-gotools:
go get -u github.com/golang/lint/golint
go get -u golang.org/x/tools/cmd/cover
go get -u golang.org/x/tools/cmd/vet

test-style:
${DEV_ENV_CMD} bash -c '${GOFMT}'
${DEV_ENV_CMD} sh -c 'go vet $(repo_path) $(GO_PACKAGES_REPO_PATH)'
@for i in $(addsuffix /...,$(GO_PACKAGES)); do \
${DEV_ENV_CMD} golint $$i; \
done
${DEV_ENV_CMD} lint

test: test-style
${DEV_ENV_PREFIX_CGO_ENABLED} ${DEV_ENV_IMAGE} sh -c '${GOTEST} $$(glide nv)'
Expand Down
2 changes: 1 addition & 1 deletion cmd/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func appURL(s *settings.Settings, appID string) (string, error) {
return expandURL(s.Client.ControllerURL.Host, domains[0].Domain), nil
}

// expandURL expands an app url if neccessary.
// expandURL expands an app url if necessary.
func expandURL(host, u string) string {
if strings.Contains(u, ".") {
// If domain is a full url.
Expand Down
6 changes: 3 additions & 3 deletions cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func Cancel(username string, password string, yes bool) error {
}
}

if yes == false {
if !yes {
confirm := ""

s, err = settings.Load()
Expand All @@ -224,7 +224,7 @@ func Cancel(username string, password string, yes bool) error {
}
}

if yes == false {
if !yes {
fmt.Fprintln(os.Stderr, "Account not changed")
return nil
}
Expand Down Expand Up @@ -281,7 +281,7 @@ func Regenerate(username string, all bool) error {
return err
}

if username == "" && all == false {
if username == "" && !all {
s.Client.Token = token

err = s.Save()
Expand Down
24 changes: 12 additions & 12 deletions settings/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,27 @@ func TestLoadSave(t *testing.T) {
}

tests := []comparison{
comparison{
{
key: false,
expected: s.Client.VerifySSL,
},
comparison{
{
key: "a",
expected: s.Client.Token,
},
comparison{
{
key: "t",
expected: s.Username,
},
comparison{
{
key: "http://foo.bar",
expected: s.Client.ControllerURL.String(),
},
comparison{
{
key: 50,
expected: s.Limit,
},
comparison{
{
key: "Deis Client v" + version.Version,
expected: s.Client.UserAgent,
},
Expand Down Expand Up @@ -107,27 +107,27 @@ func TestLoadSave(t *testing.T) {
}

tests = []comparison{
comparison{
{
key: true,
expected: s.Client.VerifySSL,
},
comparison{
{
key: "b",
expected: s.Client.Token,
},
comparison{
{
key: "c",
expected: s.Username,
},
comparison{
{
key: "http://deis.test",
expected: s.Client.ControllerURL.String(),
},
comparison{
{
key: 100,
expected: s.Limit,
},
comparison{
{
key: "Deis Client v" + version.Version,
expected: s.Client.UserAgent,
},
Expand Down

0 comments on commit cc4f07e

Please sign in to comment.