Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.22.x, 1.23.x]
go-version: [1.26.x, 1.27.x]
steps:
- name: Checkout Code
uses: actions/checkout@v7
Expand All @@ -32,5 +32,5 @@ jobs:
# conflicting guidance, run only on the most recent supported version.
# For the same reason, only check generated code on the most recent
# supported version.
if: matrix.go-version == '1.23.x'
if: matrix.go-version == '1.27.x'
run: make checkgenerate && make lint
117 changes: 74 additions & 43 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,93 @@
linters-settings:
errcheck:
check-type-assertions: true
forbidigo:
forbid:
- '^fmt\.Print'
- '^log\.'
- '^print$'
- '^println$'
- '^panic$'
godox:
# TODO, OPT, etc. comments are fine to commit. Use FIXME comments for
# temporary hacks, and use godox to prevent committing them.
keywords: [FIXME]
varnamelen:
ignore-decls:
- T any
- i int
- wg sync.WaitGroup
- sb strings.Builder
version: "2"
linters:
enable-all: true
default: all
disable:
- cyclop # covered by gocyclo
- depguard # unnecessary for small libraries
- err113 # dubious dynamic errors warnings
- exhaustive # many exceptions
- exhaustruct # many exceptions
- exhaustruct_v5 # many exceptions
- funlen # rely on code review to limit function length
- gochecknoglobals # many exceptions
- gocognit # dubious "cognitive overhead" quantification
- gofumpt # prefer standard gofmt
- goimports # rely on gci instead
- gomnd # some unnamed constants are okay
- gomodguard # replaced by gomodguard_v2
- ireturn # "accept interfaces, return structs" isn't ironclad
- lll # don't want hard limits for line length
- maintidx # covered by gocyclo
- mnd # some unnamed constants are okay
- nilnil # we allow this
- noinlineerr # excess scope violates house style
- nlreturn # generous whitespace violates house style
- tagalign # false positives
- testpackage # internal tests are fine
- thelper # we want to print out the whole stack
- wrapcheck # don't _always_ need to wrap errors
- wsl # generous whitespace violates house style
issues:
exclude-dirs-use-default: false
exclude-rules:
- linters:
- varnamelen
- goconst
path: cmd/protoc-gen-pluginrpc-go/main.go
- linters:
- varnamelen
path: pluginrpc_test.go
- linters:
- gosec
path: runner.go
- linters:
- gocritic
path: server.go
- linters:
- nestif
path: wire.go
- wsl_v5 # generous whitespace violates house style
settings:
errcheck:
check-type-assertions: true
forbidigo:
forbid:
- pattern: ^fmt\.Print
- pattern: ^log\.
- pattern: ^print$
- pattern: ^println$
- pattern: ^panic$
godox:
# TODO, OPT, etc. comments are fine to commit. Use FIXME comments for
# temporary hacks, and use godox to prevent committing them.
keywords:
- FIXME
varnamelen:
ignore-decls:
- T any
- i int
- wg sync.WaitGroup
- sb strings.Builder
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- goconst
- prealloc
- varnamelen
path: cmd/protoc-gen-pluginrpc-go/main.go
- linters:
- varnamelen
path: pluginrpc_test.go
- linters:
- gosec
path: runner.go
- linters:
- gosec
path: code.go
text: "G115:"
- linters:
- gosec
path: internal/example/cmd/echo-plugin/main.go
text: "G115:"
- linters:
- gosec
path: pluginrpc_test.go
text: "G115:"
- linters:
- gocritic
path: server.go
- linters:
- nestif
path: wire.go
formatters:
# gofumpt is not enabled: prefer standard gofmt.
# goimports is not enabled: rely on gci instead.
enable:
- gci
- gofmt
exclusions:
generated: lax
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ COPYRIGHT_YEARS := 2024
LICENSE_IGNORE := --ignore /testdata/

BUF_VERSION := v1.42.0
GO_MOD_GOTOOLCHAIN := go1.23.1
GOLANGCI_LINT_VERSION := v1.60.1
GO_MOD_GOTOOLCHAIN := go1.27.1
GOLANGCI_LINT_VERSION := v2.14.0
# https://github.com/golangci/golangci-lint/issues/4837
GOLANGCI_LINT_GOTOOLCHAIN := $(GO_MOD_GOTOOLCHAIN)

Expand Down Expand Up @@ -85,7 +85,7 @@ $(BIN)/license-header: Makefile

$(BIN)/golangci-lint: Makefile
@mkdir -p $(@D)
GOTOOLCHAIN=$(GOLANGCI_LINT_GOTOOLCHAIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
GOTOOLCHAIN=$(GOLANGCI_LINT_GOTOOLCHAIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

$(BIN)/protoc-gen-go: Makefile go.mod
@mkdir -p $(@D)
Expand Down
2 changes: 1 addition & 1 deletion cmd/protoc-gen-pluginrpc-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ func getStreamingMethodsForService(service *protogen.Service) []*protogen.Method
}

func isUnaryMethod(method *protogen.Method) bool {
return !(method.Desc.IsStreamingClient() || method.Desc.IsStreamingServer())
return !method.Desc.IsStreamingClient() && !method.Desc.IsStreamingServer()
}

// Raggedy comments in the generated code are driving me insane. This
Expand Down
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewError(code Code, underlying error) *Error {
}

// NewErrorf returns a new Error.

//
// Code and a non-empty message are required.
//
// An Error will never have an invalid Code or nil underlying error
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module pluginrpc.com/pluginrpc

go 1.23

toolchain go1.23.0
go 1.26

require (
buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.12-20241007202033-cf42259fcbfc.2
Expand Down
Loading
Loading