diff --git a/.travis.yml b/.travis.yml index a37b652..607fc05 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,12 +6,8 @@ go: - tip install: - - go get -u golang.org/x/lint/golint - - go get -u github.com/onsi/ginkgo/ginkgo - - go get -u github.com/onsi/gomega - go get -u golang.org/x/crypto/ssh - go get -u github.com/lib/pq - - go get -v -t ./... - export PATH=$PATH:$HOME/gopath/bin - export GO111MODULE=on diff --git a/Makefile b/Makefile index 41c70e8..d9886e9 100644 --- a/Makefile +++ b/Makefile @@ -4,17 +4,32 @@ FMT_CMD = $(gofmt -s -l -w $(find . -type f -name '*.go' -not -path './vendor/*' IMAGE_REPO = securego BUILDFLAGS := '-w -s' CGO_ENABLED = 0 +GO := GO111MODULE=on go +GO_NOMOD :=GO111MODULE=off go default: $(MAKE) build -test: build - test -z '$(FMT_CMD)' - go vet $(go list ./... | grep -v /vendor/) - golint -set_exit_status $(shell go list ./... | grep -v vendor) - ./$(BIN) ./... +test: build fmt lint sec + $(GO_NOMOD) get -u github.com/onsi/ginkgo/ginkgo ginkgo -r -v +fmt: + @echo "FORMATTING" + @FORMATTED=`$(GO) fmt ./...` + @([[ ! -z "$(FORMATTED)" ]] && printf "Fixed unformatted files:\n$(FORMATTED)") || true + +lint: + @echo "LINTING" + $(GO_NOMOD) get -u golang.org/x/lint/golint + golint -set_exit_status ./... + @echo "VETTING" + $(GO) vet ./... + +sec: + @echo "SECURITY SCANNING" + ./$(BIN) ./... + test-coverage: go test -race -coverprofile=coverage.txt -covermode=atomic diff --git a/README.md b/README.md index 4987ef0..8e10422 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,9 @@ gosec --help ### Local Installation -`$ go get github.com/securego/gosec/cmd/gosec +```bash +go get github.com/securego/gosec/cmd/gosec +``` ## Usage @@ -175,15 +177,6 @@ $ gosec -fmt=json -out=results.json *.go ## Development -### Prerequisites - -Install dep according to the instructions here: https://github.com/golang/dep -Install the latest version of golint: - -```bash -go get -u golang.org/x/lint/golint -``` - ### Build ```bash