diff --git a/cmd/protoc-gen-connect-go/main.go b/cmd/protoc-gen-connect-go/main.go index 633f786b..f096aab8 100644 --- a/cmd/protoc-gen-connect-go/main.go +++ b/cmd/protoc-gen-connect-go/main.go @@ -132,7 +132,9 @@ func generate(plugin *protogen.Plugin, file *protogen.File, samePackage bool) { file.GeneratedFilenamePrefix+generatedFilenameExtension, goImportPath, ) - generatedFile.Import(file.GoImportPath) + if !samePackage { + generatedFile.Import(file.GoImportPath) + } generatePreamble(generatedFile, file) generateServiceNameConstants(generatedFile, file.Services) generateServiceNameVariables(generatedFile, file)