grpc-ecosystem / grpc-gateway

gRPC to JSON proxy generator following the gRPC HTTP spec
https://grpc-ecosystem.github.io/grpc-gateway/
BSD 3-Clause "New" or "Revised" License
18.25k stars 2.24k forks source link

unable to install`protoc-gen-openapiv2` plugin #3042

Open lhmzhou opened 1 year ago

lhmzhou commented 1 year ago

🐛 Bug Report

Trying to run go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 to install the protoc-gen-openapiv2 plugin, but I'm thrown back this panic message, along with the stack trace:

panic: modindex.GetPackage called with empty modroot

goroutine 19 [running]:
cmd/go/internal/modindex.GetModule({0x0, 0x0})
    /usr/local/go/src/cmd/go/internal/modindex/read.go:157 +0x125
cmd/go/internal/modindex.GetPackage({0x0, 0x0}, {0xc0000dc320, 0x45})
    /usr/local/go/src/cmd/go/internal/modindex/read.go:135 +0x31
cmd/go/internal/modload.scanDir({0x0?, 0x3e?}, {0xc0000dc320, 0x45}, 0x0?)
    /usr/local/go/src/cmd/go/internal/modload/load.go:2105 +0x4b
cmd/go/internal/modload.(*loader).load(0xc00023f110, {0x172fa10, 0xc00009e000}, 0xc00023f2b0)
    /usr/local/go/src/cmd/go/internal/modload/load.go:1734 +0x35f
cmd/go/internal/modload.(*loader).pkg.func1.1()
    /usr/local/go/src/cmd/go/internal/modload/load.go:1517 +0x29
cmd/go/internal/par.(*Queue).Add.func1()
    /usr/local/go/src/cmd/go/internal/par/queue.go:58 +0x7d
created by cmd/go/internal/par.(*Queue).Add
    /usr/local/go/src/cmd/go/internal/par/queue.go:56 +0x225

To Reproduce

(Write your steps here:)

  1. Execute go install [github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2](http://github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2)

Expected behavior

protoc-gen-openapiv2 to be installed locally.

Actual Behavior

Here is the stack trace:

panic: modindex.GetPackage called with empty modroot

goroutine 19 [running]:
cmd/go/internal/modindex.GetModule({0x0, 0x0})
    /usr/local/go/src/cmd/go/internal/modindex/read.go:157 +0x125
cmd/go/internal/modindex.GetPackage({0x0, 0x0}, {0xc0000dc320, 0x45})
    /usr/local/go/src/cmd/go/internal/modindex/read.go:135 +0x31
cmd/go/internal/modload.scanDir({0x0?, 0x3e?}, {0xc0000dc320, 0x45}, 0x0?)
    /usr/local/go/src/cmd/go/internal/modload/load.go:2105 +0x4b
cmd/go/internal/modload.(*loader).load(0xc00023f110, {0x172fa10, 0xc00009e000}, 0xc00023f2b0)
    /usr/local/go/src/cmd/go/internal/modload/load.go:1734 +0x35f
cmd/go/internal/modload.(*loader).pkg.func1.1()
    /usr/local/go/src/cmd/go/internal/modload/load.go:1517 +0x29
cmd/go/internal/par.(*Queue).Add.func1()
    /usr/local/go/src/cmd/go/internal/par/queue.go:58 +0x7d
created by cmd/go/internal/par.(*Queue).Add
    /usr/local/go/src/cmd/go/internal/par/queue.go:56 +0x225

Your Environment

Mac OS Ventura 13.0, Apple M1 Pro

johanbrandhorst commented 1 year ago

Hi, what Go version are you using? I wasn't able to reproduce this error with Go 1.19.3.