错误
go build cmd/rest-server/main.go
go: finding google.golang.org/grpc/keepalive latest
go: finding google.golang.org/grpc/resolver latest
go: finding google.golang.org/grpc/internal/envconfig latest
go: finding google.golang.org/grpc/naming latest
go: finding google.golang.org/grpc/internal/backoff latest
go: finding google.golang.org/grpc/internal/channelz latest
go: finding google.golang.org/grpc/internal/transport latest
go: finding google.golang.org/grpc/grpclog latest
go: finding google.golang.org/grpc/metadata latest
go: finding google.golang.org/grpc/status latest
go: finding google.golang.org/grpc/internal latest
go: finding google.golang.org/grpc/resolver/passthrough latest
go: finding google.golang.org/grpc/internal/grpcsync latest
go: finding google.golang.org/grpc/stats latest
go: finding google.golang.org/grpc/resolver/dns latest
../../../../pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.6.4/runtime/context.go:15:2: unknown import path "google.golang.org/grpc/grpclog": cannot find module providing package google.golang.org/grpc/grpclog
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/clientconn.go:39:2: unknown import path "google.golang.org/grpc/internal": cannot find module providing package google.golang.org/grpc/internal
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/clientconn.go:40:2: unknown import path "google.golang.org/grpc/internal/backoff": cannot find module providing package google.golang.org/grpc/internal/backoff
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/clientconn.go:41:2: unknown import path "google.golang.org/grpc/internal/channelz": cannot find module providing package google.golang.org/grpc/internal/channelz
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/clientconn.go:42:2: unknown import path "google.golang.org/grpc/internal/envconfig": cannot find module providing package google.golang.org/grpc/internal/envconfig
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/clientconn.go:43:2: unknown import path "google.golang.org/grpc/internal/grpcsync": cannot find module providing package google.golang.org/grpc/internal/grpcsync
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/clientconn.go:44:2: unknown import path "google.golang.org/grpc/internal/transport": cannot find module providing package google.golang.org/grpc/internal/transport
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/clientconn.go:45:2: unknown import path "google.golang.org/grpc/keepalive": cannot find module providing package google.golang.org/grpc/keepalive
../../../../pkg/mod/github.com/grpc-ecosystem/grpc-gateway@v1.6.4/runtime/context.go:16:2: unknown import path "google.golang.org/grpc/metadata": cannot find module providing package google.golang.org/grpc/metadata
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/balancer.go:29:2: unknown import path "google.golang.org/grpc/naming": cannot find module providing package google.golang.org/grpc/naming
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/balancer/balancer.go:32:2: unknown import path "google.golang.org/grpc/resolver": cannot find module providing package google.golang.org/grpc/resolver
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/clientconn.go:48:2: unknown import path "google.golang.org/grpc/resolver/dns": cannot find module providing package google.golang.org/grpc/resolver/dns
../../../../pkg/mod/google.golang.org/grpc@v1.17.0/clientconn.go:49:2: unknown import path "google.golang.org/grpc/resolver/passthrough": cannot find module providing package google.golang.org/grpc/resolver/passthrough
使用 `go clean -modcache` 命令解决了这个问题。