-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include Go 1.21.0 in CI, and update `golangci-lint` to a version that supports the new runtime. Along the way, clean up the Makefile a bit and update some tool dependencies. As part of this change, we're committing to support for the last 3 versions of Go. This ends up including a version of Go that no longer receives security patches, but it matches AWS and some large companies' very slow upgrade cycles.
- Loading branch information
1 parent
8aa51de
commit 5bfdd3c
Showing
5 changed files
with
18 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ MAKEFLAGS += --warn-undefined-variables | |
MAKEFLAGS += --no-builtin-rules | ||
MAKEFLAGS += --no-print-directory | ||
BIN := .tmp/bin | ||
export PATH := $(BIN):$(PATH) | ||
export GOBIN := $(abspath $(BIN)) | ||
COPYRIGHT_YEARS := 2021-2023 | ||
LICENSE_IGNORE := --ignore /testdata/ | ||
# Set to use a different compiler. For example, `GO=go1.18rc1 make test`. | ||
|
@@ -42,20 +44,20 @@ install: ## Install all binaries | |
lint: $(BIN)/golangci-lint $(BIN)/buf ## Lint Go and protobuf | ||
test -z "$$($(BIN)/buf format -d . | tee /dev/stderr)" | ||
$(GO) vet ./... | ||
$(BIN)/golangci-lint run | ||
$(BIN)/buf lint | ||
$(BIN)/buf format -d --exit-code | ||
golangci-lint run | ||
buf lint | ||
buf format -d --exit-code | ||
|
||
.PHONY: lintfix | ||
lintfix: $(BIN)/golangci-lint $(BIN)/buf ## Automatically fix some lint errors | ||
$(BIN)/golangci-lint run --fix | ||
$(BIN)/buf format -w | ||
golangci-lint run --fix | ||
buf format -w | ||
|
||
.PHONY: generate | ||
generate: $(BIN)/buf $(BIN)/protoc-gen-go $(BIN)/protoc-gen-connect-go $(BIN)/license-header ## Regenerate code and licenses | ||
rm -rf internal/gen | ||
PATH="$(abspath $(BIN))" $(BIN)/buf generate | ||
$(BIN)/license-header \ | ||
license-header \ | ||
--license-type apache \ | ||
--copyright-holder "Buf Technologies, Inc." \ | ||
--year-range "$(COPYRIGHT_YEARS)" $(LICENSE_IGNORE) | ||
|
@@ -76,19 +78,18 @@ $(BIN)/protoc-gen-connect-go: | |
|
||
$(BIN)/buf: Makefile | ||
@mkdir -p $(@D) | ||
GOBIN="$(abspath $(@D))" $(GO) install github.com/bufbuild/buf/cmd/[email protected] | ||
$(GO) install github.com/bufbuild/buf/cmd/[email protected] | ||
|
||
$(BIN)/license-header: Makefile | ||
@mkdir -p $(@D) | ||
GOBIN="$(abspath $(@D))" $(GO) install \ | ||
github.com/bufbuild/buf/private/pkg/licenseheader/cmd/[email protected] | ||
$(GO) install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/[email protected] | ||
|
||
$(BIN)/golangci-lint: Makefile | ||
@mkdir -p $(@D) | ||
GOBIN="$(abspath $(@D))" $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 | ||
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.1 | ||
|
||
$(BIN)/protoc-gen-go: Makefile go.mod | ||
@mkdir -p $(@D) | ||
@# The version of protoc-gen-go is determined by the version in go.mod | ||
GOBIN="$(abspath $(@D))" $(GO) install google.golang.org/protobuf/cmd/protoc-gen-go | ||
$(GO) install google.golang.org/protobuf/cmd/protoc-gen-go | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters