Skip to content

Commit

Permalink
chore: refactor tasks in GNUmakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
MaineK00n committed Apr 8, 2022
1 parent ece26b2 commit 7a31a80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
23 changes: 10 additions & 13 deletions GNUmakefile
Expand Up @@ -23,12 +23,9 @@ CGO_UNABLED := CGO_ENABLED=0 go
GO_OFF := GO111MODULE=off go


all: b
all: build test

build: ./cmd/vuls/main.go pretest fmt
$(GO) build -a -ldflags "$(LDFLAGS)" -o vuls ./cmd/vuls

b: ./cmd/vuls/main.go
build: ./cmd/vuls/main.go
$(GO) build -a -ldflags "$(LDFLAGS)" -o vuls ./cmd/vuls

install: ./cmd/vuls/main.go
Expand All @@ -41,13 +38,14 @@ install-scanner: ./cmd/scanner/main.go
$(CGO_UNABLED) install -tags=scanner -ldflags "$(LDFLAGS)" ./cmd/scanner

lint:
$(GO_OFF) get -u github.com/mgechev/revive
$(GO) install github.com/mgechev/revive@latest
revive -config ./.revive.toml -formatter plain $(PKGS)

vet:
echo $(PKGS) | xargs env $(GO) vet || exit;

golangci:
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run

fmt:
Expand All @@ -59,9 +57,9 @@ mlint:
fmtcheck:
$(foreach file,$(SRCS),gofmt -s -d $(file);)

pretest: lint vet fmtcheck golangci
pretest: lint vet fmtcheck

test:
test: pretest
$(GO) test -cover -v ./... || exit;

unused:
Expand All @@ -76,13 +74,12 @@ clean:
echo $(PKGS) | xargs go clean || exit;

# trivy-to-vuls
build-trivy-to-vuls: pretest fmt
$(GO) build -a -ldflags "$(LDFLAGS)" -o trivy-to-vuls contrib/trivy/cmd/*.go
build-trivy-to-vuls: ./contrib/trivy/cmd/main.go
$(GO) build -a -ldflags "$(LDFLAGS)" -o trivy-to-vuls ./contrib/trivy/cmd

# future-vuls
build-future-vuls: pretest fmt
$(GO) build -a -ldflags "$(LDFLAGS)" -o future-vuls contrib/future-vuls/cmd/*.go

build-future-vuls: ./contrib/future-vuls/cmd/main.go
$(GO) build -a -ldflags "$(LDFLAGS)" -o future-vuls ./contrib/future-vuls/cmd

# integration-test
BASE_DIR := '${PWD}/integration/results'
Expand Down
1 change: 0 additions & 1 deletion contrib/Dockerfile
Expand Up @@ -5,7 +5,6 @@ RUN apk add --no-cache \
make \
gcc \
musl-dev
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

ENV REPOSITORY github.com/future-architect/vuls
COPY . $GOPATH/src/$REPOSITORY
Expand Down

0 comments on commit 7a31a80

Please sign in to comment.