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: script:
## Run all the tests ## Run all the tests
- make - make
- diff -au <(gofmt -d cmd) <(printf "")
- diff -au <(gofmt -d pkg) <(printf "")
- make test GOFLAGS="-timeout 15m -race -v" - make test GOFLAGS="-timeout 15m -race -v"
- make coverage - make coverage

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

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

Loading…
Cancel
Save