1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00

Some makefile fixes (#442)

* Generate and build before linting

Generated files may require some formatting that happens during
linting. Also missing generated files may result in linter failures.

Building can shake out any syntax/semantic errors and report them in a
much nicer way than the linter does. Which is exactly the reason the
build was running before linters before the Makefile simplification.

* Make stringer tool a dep of generate target, not lint

Lint target does not use the stringer utility - it is being used by go
generate.
This commit is contained in:
Krzesimir Nowak
2020-01-24 21:06:24 +01:00
committed by Liz Fong-Jones
parent 20bb650b2d
commit 027855962b
+3 -3
View File
@@ -25,7 +25,7 @@ $(TOOLS_DIR)/misspell: go.mod go.sum tools.go
$(TOOLS_DIR)/stringer: go.mod go.sum tools.go
go build -o $(TOOLS_DIR)/stringer golang.org/x/tools/cmd/stringer
precommit: lint generate build examples test
precommit: generate build lint examples test
.PHONY: test-with-coverage
test-with-coverage:
@@ -84,7 +84,7 @@ examples:
done
.PHONY: lint
lint: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell $(TOOLS_DIR)/stringer
lint: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
echo "golangci-lint in $${dir}"; \
(cd "$${dir}" && \
@@ -98,5 +98,5 @@ lint: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell $(TOOLS_DIR)/stringer
go mod tidy); \
done
generate:
generate: $(TOOLS_DIR)/stringer
PATH="$(abspath $(TOOLS_DIR)):$${PATH}" go generate ./...