Skip to content

Commit

Permalink
Avoid running staticchek twice, once in golangci and one directly (#2578
Browse files Browse the repository at this point in the history
)

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu authored Mar 2, 2021
1 parent 73db88f commit fb36c26
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 17 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include ./Makefile.Common

# This is the code that we want to run checklicense, staticcheck, etc.
# This is the code that we want to run lint, etc.
ALL_SRC := $(shell find . -name '*.go' \
-not -path './cmd/issuegenerator/*' \
-not -path './cmd/mdatagen/*' \
Expand Down Expand Up @@ -147,7 +147,6 @@ install-tools:
cd $(TOOLS_MOD_DIR) && go install github.com/pavius/impi/cmd/impi
cd $(TOOLS_MOD_DIR) && go install github.com/tcnksm/ghr
cd $(TOOLS_MOD_DIR) && go install golang.org/x/tools/cmd/goimports
cd $(TOOLS_MOD_DIR) && go install honnef.co/go/tools/cmd/staticcheck
cd cmd/mdatagen && go install ./

.PHONY: otelcol
Expand Down
14 changes: 1 addition & 13 deletions Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ GOTEST=go test
ADDLICENCESE=addlicense
MISSPELL=misspell -error
MISSPELL_CORRECTION=misspell -w
STATIC_CHECK=staticcheck
LINT=golangci-lint
IMPI=impi

Expand Down Expand Up @@ -61,19 +60,8 @@ fmt:
gofmt -w -s ./
goimports -w -local go.opentelemetry.io/collector ./

.PHONY: lint-static-check
lint-static-check:
@STATIC_CHECK_OUT=`$(STATIC_CHECK) $(ALL_PKGS) 2>&1`; \
if [ "$$STATIC_CHECK_OUT" ]; then \
echo "$(STATIC_CHECK) FAILED => static check errors:\n"; \
echo "$$STATIC_CHECK_OUT\n"; \
exit 1; \
else \
echo "Static check finished successfully"; \
fi

.PHONY: lint
lint: lint-static-check
lint:
$(LINT) run --allow-parallel-runners

.PHONY: misspell
Expand Down
1 change: 0 additions & 1 deletion internal/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ require (
github.com/pavius/impi v0.0.3
github.com/tcnksm/ghr v0.13.0
golang.org/x/tools v0.1.0
honnef.co/go/tools v0.0.1-2020.1.6
)
1 change: 0 additions & 1 deletion internal/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ import (
_ "github.com/pavius/impi/cmd/impi"
_ "github.com/tcnksm/ghr"
_ "golang.org/x/tools/cmd/goimports"
_ "honnef.co/go/tools/cmd/staticcheck"
)

0 comments on commit fb36c26

Please sign in to comment.