Skip to content

Commit

Permalink
fix make lint and make gosec error (wtfutil#1127)
Browse files Browse the repository at this point in the history
fix wtfutil#1127

Install golangci-lint / gosec, if it is not installed.
If we only support over go 1.16, we should use go install instead of go
get.

Use binary installation for golangci-lint because they recommends.
https://golangci-lint.run/usage/install/#local-installation
  • Loading branch information
yosmoc committed Oct 13, 2021
1 parent 9918480 commit 4dd1148
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export GOPROXY = https://proxy.golang.org,direct
# Determines the path to this Makefile
THIS_FILE := $(lastword $(MAKEFILE_LIST))

GOBIN := $(GOPATH)/bin

APP=wtfutil

define HEADER
Expand Down Expand Up @@ -77,9 +79,12 @@ docker-install:
docker rm wtf_build

## gosec: runs the gosec static security scanner against the source code
gosec:
gosec: $(GOBIN)/gosec
gosec -tests ./...

$(GOBIN)/gosec:
cd && go get -u github.com/securego/gosec/v2/cmd/gosec

## help: prints this help message
help:
@echo "Usage: \n"
Expand All @@ -101,10 +106,13 @@ install:
@echo "${APP} installed into ${INSTALLPATH}"

## lint: runs a number of code quality checks against the source code
lint:
lint: $(GOBIN)/golangci-lint
golangci-lint cache clean
golangci-lint run

$(GOBIN)/golangci-lint:
cd && go get github.com/golangci/golangci-lint/cmd/[email protected]

# lint:
# @echo "\033[35mhttps://github.com/kisielk/errcheck\033[0m"
# errcheck ./app
Expand Down

0 comments on commit 4dd1148

Please sign in to comment.