Skip to content

Commit

Permalink
[chore] Run porto after go generate (#3820)
Browse files Browse the repository at this point in the history
* Run porto after go generate

* Add missing vanity imports

* Fix whitespace

* Fix tests

* Fix testdata

* Change to space

* Lint

* make generate

* Refactor generate Make target

* Revert instrgen test changes

---------

Co-authored-by: Tyler Yahn <[email protected]>
  • Loading branch information
pellared and MrAlias authored May 18, 2023
1 parent 95167fd commit e8a2a70
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
path: ~/.tools
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }}
- name: Run go generate
- name: Generate
run: make generate
- name: Run linters
run: make dependabot-check license-check lint vanity-import-check
Expand Down
23 changes: 14 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TIMEOUT = 60
.DEFAULT_GOAL := precommit

.PHONY: precommit ci
precommit: generate dependabot-generate license-check misspell go-mod-tidy vanity-import-fix golangci-lint-fix test-default
precommit: generate dependabot-generate license-check misspell go-mod-tidy golangci-lint-fix test-default
ci: generate dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage

# Tools
Expand Down Expand Up @@ -68,19 +68,28 @@ $(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/build-tools/dbotconf
CROSSLINK = $(TOOLS)/crosslink
$(CROSSLINK): PACKAGE=go.opentelemetry.io/build-tools/crosslink

tools: $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(MULTIMOD) $(DBOTCONF) $(CROSSLINK)
GOTMPL = $(TOOLS)/gotmpl
$(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl

tools: $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(MULTIMOD) $(DBOTCONF) $(CROSSLINK) $(GOTMPL)

# Generate

.PHONY: generate
generate: go-generate vanity-import-fix

generate: $(OTEL_GO_MOD_DIRS:%=generate/%)
generate/%: DIR=$*
generate/%: | $(STRINGER)
.PHONY: go-generate
go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%)
go-generate/%: DIR=$*
go-generate/%: | $(STRINGER) $(PORTO)
@echo "$(GO) generate $(DIR)/..." \
&& cd $(DIR) \
&& PATH="$(TOOLS):$${PATH}" $(GO) generate ./...

.PHONY: vanity-import-fix
vanity-import-fix: | $(PORTO)
@$(PORTO) --include-internal -w .

# Build

.PHONY: build
Expand Down Expand Up @@ -133,10 +142,6 @@ misspell: | $(MISSPELL)
vanity-import-check: | $(PORTO)
@$(PORTO) --include-internal -l . || echo "(run: make vanity-import-fix)"

.PHONY: vanity-import-fix
vanity-import-fix: | $(PORTO)
@$(PORTO) --include-internal -w .

.PHONY: lint
lint: go-mod-tidy golangci-lint misspell

Expand Down

0 comments on commit e8a2a70

Please sign in to comment.