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

[3.x] Keep arguments in protoc to a minimum #248

Merged
merged 1 commit into from
Apr 14, 2024
Merged
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
31 changes: 7 additions & 24 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,9 @@ func main() {

// generate pb.go and grpc server based on proto
generateProtoc(ctx, protocParam{
protoPath: protoPaths,
adminHost: conf.HTTP.Host,
adminPort: conf.HTTP.Port,
grpcNet: conf.GRPC.Network,
grpcAddress: conf.GRPC.Host,
grpcPort: conf.GRPC.Port,
otlpHost: conf.OTLPTrace.Host,
otlpPort: conf.OTLPTrace.Port,
otlpTLS: conf.OTLPTrace.TLS,
otlpSampleRatio: conf.OTLPTrace.SampleRatio,
output: output,
imports: importDirs,
protoPath: protoPaths,
output: output,
imports: importDirs,
})

// and run
Expand Down Expand Up @@ -173,18 +164,9 @@ func main() {
}

type protocParam struct {
protoPath []string
adminHost string
adminPort string
grpcAddress string
grpcNet string
grpcPort string
output string
otlpHost string
otlpPort string
otlpTLS bool
otlpSampleRatio float64
imports []string
protoPath []string
output string
imports []string
}

func getProtodirs(_ context.Context, protoPath string, imports []string) []string {
Expand Down Expand Up @@ -294,6 +276,7 @@ func fixGoPackage(ctx context.Context, protoPaths []string) []string {

func runGrpcServer(ctx context.Context, output string) (*exec.Cmd, <-chan error) {
run := exec.CommandContext(ctx, "go", "run", output+"server.go") //nolint:gosec
run.Env = os.Environ()
run.Stdout = os.Stdout
run.Stderr = os.Stderr

Expand Down
Loading