Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protoc-gen-go-grpc: empty const block causing gofmt failure #7054

Closed
conorevans opened this issue Mar 20, 2024 · 0 comments · Fixed by #7055
Closed

protoc-gen-go-grpc: empty const block causing gofmt failure #7054

conorevans opened this issue Mar 20, 2024 · 0 comments · Fixed by #7055

Comments

@conorevans
Copy link
Contributor

conorevans commented Mar 20, 2024

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant