protoc-gen-go-grpc: empty const block causing `gofmt` failure
conorevans opened this issue · comments
Conor Evans commented
What version of gRPC are you using?
✗ protoc-gen-go --version
protoc-gen-go v1.28.1
✗ protoc --version
libprotoc 3.19.4
What version of Go are you using (go version
)?
✗ go version
go version go1.20.5 darwin/arm64
What operating system (Linux, Windows, …) and version?
macOS 14.4 (23E214)
What did you do?
Generate Go protos off the following empty service definition
syntax = "proto3";
package foobar;
option go_package = "github.com/foobar";
service Foobar {}
which leads to
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v4.25.3
// source: service-foobar.proto
package popsa
import (
grpc "google.golang.org/grpc"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const ()
// FoobarClient is the client API for Foobar service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type FoobarClient interface {
}
What did you expect to see?
No gofmt
error
What did you see instead?
gofmt
error due to empty const block (since no methods are defined)
I am aware that an empty service proto definition is a bit pointless, but I dealt with a broken workflow due to it today, and figured I'd fix it in the generator