-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linting and formatting configurations with makefile
Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>
- Loading branch information
Showing
5 changed files
with
1,136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Go parameters | ||
GOCMD?=go | ||
GO_VERSION=$(shell go list -m -f "{{.GoVersion}}") | ||
PACKAGE_BASE=github.com/buildpacks/libcnb | ||
|
||
all: test | ||
|
||
install-goimports: | ||
@echo "> Installing goimports..." | ||
cd tools && $(GOCMD) install golang.org/x/tools/cmd/goimports | ||
|
||
format: install-goimports | ||
@echo "> Formating code..." | ||
@goimports -l -w -local ${PACKAGE_BASE} . | ||
|
||
install-golangci-lint: | ||
@echo "> Installing golangci-lint..." | ||
cd tools && $(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint | ||
|
||
lint: install-golangci-lint | ||
@echo "> Linting code..." | ||
@golangci-lint run -c golangci.yaml | ||
|
||
test: format lint | ||
$(GOCMD) test -parallel=1 -count=1 -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
run: | ||
timeout: 6m | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- deadcode | ||
- dogsled | ||
- gocritic | ||
- goimports | ||
- golint | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- maligned | ||
- misspell | ||
- nakedret | ||
- scopelint | ||
- staticcheck | ||
- structcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unused | ||
- varcheck | ||
- whitespace | ||
|
||
linters-settings: | ||
goimports: | ||
local-prefixes: github.com/buildpacks/libcnb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module github.com/buildpacks/libcnb/tools | ||
|
||
go 1.15 | ||
|
||
require golang.org/x/tools v0.1.4 | ||
|
||
require github.com/golangci/golangci-lint v1.41.1 |
Oops, something went wrong.