Makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. GOPATH := $(shell go env GOPATH)
  2. TMPDIR := $(shell mktemp -d)
  3. all: checks
  4. .PHONY: examples docs
  5. checks: lint vet test examples functional-test
  6. lint:
  7. @mkdir -p ${GOPATH}/bin
  8. @which golangci-lint 1>/dev/null || (echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.27.0)
  9. @echo "Running $@ check"
  10. @GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean
  11. @GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ./.golangci.yml
  12. vet:
  13. @GO111MODULE=on go vet ./...
  14. test:
  15. @GO111MODULE=on SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minio SECRET_KEY=minio123 ENABLE_HTTPS=1 MINT_MODE=full go test -race -v ./...
  16. examples:
  17. @echo "Building s3 examples"
  18. @cd ./examples/s3 && $(foreach v,$(wildcard examples/s3/*.go),go build -mod=mod -o ${TMPDIR}/$(basename $(v)) $(notdir $(v)) || exit 1;)
  19. @echo "Building minio examples"
  20. @cd ./examples/minio && $(foreach v,$(wildcard examples/minio/*.go),go build -mod=mod -o ${TMPDIR}/$(basename $(v)) $(notdir $(v)) || exit 1;)
  21. functional-test:
  22. @GO111MODULE=on SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minio SECRET_KEY=minio123 ENABLE_HTTPS=1 MINT_MODE=full go run functional_tests.go
  23. clean:
  24. @echo "Cleaning up all the generated files"
  25. @find . -name '*.test' | xargs rm -fv
  26. @find . -name '*~' | xargs rm -fv