mirror of
https://github.com/fullstorydev/grpcurl.git
synced 2026-11-22 07:16:34 +03:00
f5c25e012b
* Go 1.26 baseline, golangci-lint, dependency updates - Go baseline is now 1.26 (`go.mod`); CI tests the two newest majors, 1.26 and 1.27 (previously 1.23-1.25). - Replaces the separate gofmt/vet/staticcheck/ineffassign/predeclared Makefile targets (and the unused golint/errcheck ones) with a single pinned `golangci-lint` v2 (`make lint`), configured in `.golangci.yml` to run the same checks. - `go get -u -t ./... && go mod tidy`. - Release workflow and Dockerfile now build with Go 1.27 (newest), while `go.mod` keeps 1.26 as the oldest supported version. - Lint fixes: none needed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Regenerate protos and reformat with Go 1.27 Go 1.27's gofmt reformats doc comments in generated code, and CI's checkgenerate runs on 1.27. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
75 lines
2.0 KiB
Makefile
75 lines
2.0 KiB
Makefile
dev_build_version=$(shell git describe --tags --always --dirty)
|
|
|
|
export PATH := $(shell pwd)/.tmp/protoc/bin:$(PATH)
|
|
export PROTOC_VERSION := 22.0
|
|
# Disable CGO for improved compatibility across distros
|
|
export CGO_ENABLED=0
|
|
export GOFLAGS=-trimpath
|
|
export GOWORK=off
|
|
|
|
# TODO: run golint and errcheck, but only to catch *new* violations and
|
|
# decide whether to change code or not (e.g. we need to be able to whitelist
|
|
# violations already in the code). They can be useful to catch errors, but
|
|
# they are just too noisy to be a requirement for a CI -- we don't even *want*
|
|
# to fix some of the things they consider to be violations.
|
|
.PHONY: ci
|
|
ci: deps checkgenerate lint test
|
|
|
|
.PHONY: deps
|
|
deps:
|
|
go get -d -v -t ./...
|
|
go mod tidy
|
|
|
|
.PHONY: updatedeps
|
|
updatedeps:
|
|
go get -d -v -t -u -f ./...
|
|
go mod tidy
|
|
|
|
.PHONY: install
|
|
install:
|
|
go install -ldflags '-X "main.version=dev build $(dev_build_version)"' ./...
|
|
|
|
GORELEASER_VERSION := v2.5.0
|
|
# Extra flags for goreleaser, e.g. "--skip=publish" for a dry run.
|
|
GORELEASER_ARGS ?=
|
|
|
|
.PHONY: release
|
|
release:
|
|
@go install github.com/goreleaser/goreleaser/v2@$(GORELEASER_VERSION)
|
|
goreleaser release --clean $(GORELEASER_ARGS)
|
|
|
|
.PHONY: docker
|
|
docker:
|
|
@echo $(dev_build_version) > VERSION
|
|
docker build -t fullstorydev/grpcurl:$(dev_build_version) .
|
|
@rm VERSION
|
|
|
|
.PHONY: generate
|
|
generate: .tmp/protoc/bin/protoc
|
|
@go install google.golang.org/protobuf/cmd/protoc-gen-go@a709e31e5d12
|
|
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0
|
|
@go install github.com/jhump/protoreflect/desc/sourceinfo/cmd/protoc-gen-gosrcinfo@v1.14.1
|
|
go generate ./...
|
|
go mod tidy
|
|
|
|
.PHONY: checkgenerate
|
|
checkgenerate: generate
|
|
git status --porcelain -- '**/*.go'
|
|
@if [ -n "$$(git status --porcelain -- '**/*.go')" ]; then \
|
|
git diff -- '**/*.go'; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: lint
|
|
lint:
|
|
@go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.15.0
|
|
golangci-lint run ./...
|
|
|
|
.PHONY: test
|
|
test: deps
|
|
CGO_ENABLED=1 go test -race ./...
|
|
|
|
.tmp/protoc/bin/protoc: ./Makefile ./download_protoc.sh
|
|
./download_protoc.sh
|
|
|