diff --git a/.make/Makefile.go b/.make/Makefile.go index 21f2f73..7e03ce5 100644 --- a/.make/Makefile.go +++ b/.make/Makefile.go @@ -13,7 +13,7 @@ DARWIN=$(BINARY_NAME)-darwin LINUX=$(BINARY_NAME)-linux WINDOWS=$(BINARY_NAME)-windows.exe -.PHONY: test lint install +.PHONY: test lint vet install bench: ## Run all benchmarks in the Go application @go test -bench=. -benchmem @@ -40,27 +40,24 @@ install: ## Install the application install-go: ## Install the application (Using Native Go) @go install $(GIT_DOMAIN)/$(REPO_OWNER)/$(REPO_NAME) -lint:: ## Run the Go lint application - @if [ "$(shell command -v golint)" = "" ]; then go get -u golang.org/x/lint/golint; fi - @golint +lint: ## Run the golangci-lint application (install if not found) + @if [ "$(shell command -v golangci-lint)" = "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0; fi; + @echo "running golangci-lint..." + @golangci-lint run test: ## Runs vet, lint and ALL tests - @$(MAKE) vet @$(MAKE) lint @go test ./... -v test-short: ## Runs vet, lint and tests (excludes integration tests) - @$(MAKE) vet @$(MAKE) lint @go test ./... -v -test.short test-travis: ## Runs all tests via Travis (also exports coverage) - @$(MAKE) vet @$(MAKE) lint @go test ./... -race -coverprofile=coverage.txt -covermode=atomic test-travis-short: ## Runs unit tests via Travis (also exports coverage) - @$(MAKE) vet @$(MAKE) lint @go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic @@ -77,4 +74,5 @@ update: ## Update all project dependencies @go get -u ./... && go mod tidy vet: ## Run the Go vet application + @echo "running go vet..." @go vet -v ./... \ No newline at end of file diff --git a/CODE_STANDARDS.md b/CODE_STANDARDS.md index 27f131e..5f0b66b 100644 --- a/CODE_STANDARDS.md +++ b/CODE_STANDARDS.md @@ -7,10 +7,8 @@ This project uses the following code standards and specifications from: - [go tests](https://golang.org/pkg/testing/) - [godoc](https://godoc.org/golang.org/x/tools/cmd/godoc) - [gofmt](https://golang.org/cmd/gofmt/) -- [golangci-lint](https://golangci-lint.run/usage/quick-start/) -- [golint](https://github.com/golang/lint) (deprecated) +- [golangci-lint](https://golangci-lint.run/) - [report card](https://goreportcard.com/) -- [vet](https://golang.org/cmd/vet/) ### *effective go* standards View the [effective go](https://golang.org/doc/effective_go.html) standards documentation. @@ -18,28 +16,18 @@ View the [effective go](https://golang.org/doc/effective_go.html) standards docu ### *golangci-lint* specifications The package [golangci-lint](https://golangci-lint.run/usage/quick-start) runs several linters in one package/cmd. -How to install [golangci-lint](https://golangci-lint.run/): -```shell script -brew install golangci-lint -``` - -### *golint* specifications (deprecated) -The package [golint](https://github.com/golang/lint) differs from [gofmt](https://golang.org/cmd/gofmt/). The package [gofmt](https://golang.org/cmd/gofmt/) formats Go source code, whereas [golint](https://github.com/golang/lint) prints out style mistakes. The package [golint](https://github.com/golang/lint) differs from [vet](https://golang.org/cmd/vet/). The package [vet](https://golang.org/cmd/vet/) is concerned with correctness, whereas [golint](https://github.com/golang/lint) is concerned with coding style. The package [golint](https://github.com/golang/lint) is in use at Google, and it seeks to match the accepted style of the open source [Go project](https://golang.org/). +View the active linters in the [configuration file](.golangci.yml). -How to install [golint](https://github.com/golang/lint): -```shell script -go get -u golang.org/x/lint/golint -cd ../go-bitcoin -golint +Install via macOS: +```shell +brew install golangci-lint ``` -### *go vet* specifications -[Vet](https://golang.org/cmd/vet/) examines Go source code and reports suspicious constructs. [Vet](https://golang.org/cmd/vet/) uses heuristics that do not guarantee all reports are genuine problems, but it can find errors not caught by the compilers. - -How to run [vet](https://golang.org/cmd/vet/): -```shell script -cd ../go-bitcoin -go vet -v +Install via Linux and Windows: +```shell +# binary will be $(go env GOPATH)/bin/golangci-lint +curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0 +golangci-lint --version ``` ### *godoc* specifications diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22f2714..2c1c075 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,6 +13,5 @@ All tests follow the standard Go testing pattern. This project follows [effective Go standards](https://golang.org/doc/effective_go.html) and uses additional convention tools: - [godoc](https://godoc.org/golang.org/x/tools/cmd/godoc) -- [golint](https://github.com/golang/lint) -- [vet](https://golang.org/cmd/vet/) -- [GoReportCard.com](https://goreportcard.com/report/github.com/BitcoinSchema/go-bitcoin) \ No newline at end of file +- [golangci-lint](https://golangci-lint.run/) +- [GoReportCard.com](https://goreportcard.com/) \ No newline at end of file diff --git a/Makefile b/Makefile index c87c6ff..1da0f51 100644 --- a/Makefile +++ b/Makefile @@ -24,10 +24,6 @@ clean: ## Remove previous builds and any test cache data @test $(DISTRIBUTIONS_DIR) @if [ -d $(DISTRIBUTIONS_DIR) ]; then rm -r $(DISTRIBUTIONS_DIR); fi -lint:: ## Runs the golangci-lint tool - @echo "running golangci-lint..." - @golangci-lint run - release:: ## Runs common.release then runs godocs @$(MAKE) godocs