Fail if formatting is wrong in our CI tests. (#4459)

We didn't fail before, we should helps in avoiding
formatting issues to creep into the codebase.
master
Harshavardhana 8 years ago committed by GitHub
parent 18c4e5d357
commit 432bf7d99e
  1. 2
      .travis.yml
  2. 62
      Makefile
  3. 1
      cmd/gateway-main.go

@ -18,6 +18,8 @@ env:
script:
## Run all the tests
- make
- diff -au <(gofmt -d cmd) <(printf "")
- diff -au <(gofmt -d pkg) <(printf "")
- make test GOFLAGS="-timeout 15m -race -v"
- make coverage

@ -1,6 +1,7 @@
LDFLAGS := $(shell go run buildscripts/gen-ldflags.go)
PWD := $(shell pwd)
GOPATH := $(shell go env GOPATH)
BUILD_LDFLAGS := '$(LDFLAGS)'
TAG := latest
@ -56,55 +57,43 @@ endif
all: install
checks:
@echo -n "Check deps: "
@echo "Check deps"
@(env bash $(PWD)/buildscripts/checkdeps.sh)
@echo "Done."
@echo -n "Checking project is in GOPATH: "
@echo "Checking project is in GOPATH"
@(env bash $(PWD)/buildscripts/checkgopath.sh)
@echo "Done."
getdeps: checks
@echo -n "Installing golint: " && go get -u github.com/golang/lint/golint
@echo "Done."
@echo -n "Installing gocyclo: " && go get -u github.com/fzipp/gocyclo
@echo "Done."
@echo -n "Installing deadcode: " && go get -u github.com/remyoudompheng/go-misc/deadcode
@echo "Done."
@echo -n "Installing misspell: " && go get -u github.com/client9/misspell/cmd/misspell
@echo "Done."
@echo -n "Installing ineffassign: " && go get -u github.com/gordonklaus/ineffassign
@echo "Done."
@echo "Installing golint" && go get -u github.com/golang/lint/golint
@echo "Installing gocyclo" && go get -u github.com/fzipp/gocyclo
@echo "Installing deadcode" && go get -u github.com/remyoudompheng/go-misc/deadcode
@echo "Installing misspell" && go get -u github.com/client9/misspell/cmd/misspell
@echo "Installing ineffassign" && go get -u github.com/gordonklaus/ineffassign
verifiers: vet fmt lint cyclo spelling
vet:
@echo -n "Running $@: "
@echo "Running $@"
@go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult cmd
@go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult pkg
@echo "Done."
fmt:
@echo -n "Running $@: "
@gofmt -s -l cmd
@gofmt -s -l pkg
@echo "Done."
@echo "Running $@"
@gofmt -d cmd
@gofmt -d pkg
lint:
@echo -n "Running $@: "
@echo "Running $@"
@${GOPATH}/bin/golint -set_exit_status github.com/minio/minio/cmd...
@${GOPATH}/bin/golint -set_exit_status github.com/minio/minio/pkg...
@echo "Done."
ineffassign:
@echo -n "Running $@: "
@echo "Running $@"
@${GOPATH}/bin/ineffassign .
@echo "Done."
cyclo:
@echo -n "Running $@: "
@echo "Running $@"
@${GOPATH}/bin/gocyclo -over 100 cmd
@${GOPATH}/bin/gocyclo -over 100 pkg
@echo "Done."
build: getdeps verifiers $(UI_ASSETS)
@ -117,30 +106,30 @@ spelling:
@${GOPATH}/bin/misspell -error `find docs/`
test: build
@echo -n "Running all minio testing: "
@echo "Running all minio testing"
@go test $(GOFLAGS) .
@go test $(GOFLAGS) github.com/minio/minio/cmd...
@go test $(GOFLAGS) github.com/minio/minio/pkg...
@echo "Done."
coverage: build
@echo "Running all coverage for minio: "
@echo "Running all coverage for minio"
@./buildscripts/go-coverage.sh
@echo "Done."
gomake-all: build
@echo -n "Installing minio at $(GOPATH)/bin/minio: "
@echo "Installing minio at $(GOPATH)/bin/minio"
@go build --ldflags $(BUILD_LDFLAGS) -o $(GOPATH)/bin/minio
@echo "Done."
pkg-add:
${GOPATH}/bin/govendor add $(PKG)
@echo "Adding new package $(PKG)"
@${GOPATH}/bin/govendor add $(PKG)
pkg-update:
${GOPATH}/bin/govendor update $(PKG)
@echo "Updating new package $(PKG)"
@${GOPATH}/bin/govendor update $(PKG)
pkg-remove:
${GOPATH}/bin/govendor remove $(PKG)
@echo "Remove new package $(PKG)"
@${GOPATH}/bin/govendor remove $(PKG)
pkg-list:
@$(GOPATH)/bin/govendor list
@ -154,8 +143,7 @@ experimental: verifiers
@MINIO_RELEASE=EXPERIMENTAL ./buildscripts/build.sh
clean:
@echo -n "Cleaning up all the generated files: "
@echo "Cleaning up all the generated files"
@find . -name '*.test' | xargs rm -fv
@rm -rf build
@rm -rf release
@echo "Done."

@ -112,6 +112,7 @@ func mustSetBrowserSettingFromEnv(){
globalIsBrowserEnabled = bool(browserFlag)
}
}
// Initialize gateway layer depending on the backend type.
// Supported backend types are
//

Loading…
Cancel
Save