hashicorp / consul

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
https://www.consul.io
Other
28.31k stars 4.42k forks source link

Vendored "protoc-gen-validate" is misplaced [FTBFS] #6844

Open onlyjob opened 4 years ago

onlyjob commented 4 years ago

Vendored github.com/envoyproxy/protoc-gen-validate is in the wrong place. Formerly in Consul 1.4.* "protoc-gen-validate" was vendored as vendor/github.com/lyft/protoc-gen-validate but for some strange reason it was moved under vendor/github.com/envoyproxy in 1.5.

This issue is responsible for FTBFS similar to #6458 and #6140.

richbourne commented 4 years ago

Hi, any movement on this one? In a clean go1.13.11 container with an empty GOPATH...

go get -u github.com/hashicorp/consul

yields...

/go/src/github.com/hashicorp/consul/vendor/github.com/envoyproxy/go-control-plane/envoy/type/http_status.pb.go:11:2: code in directory /go/src/github.com/hashicorp/consul/vendor/github.com/envoyproxy/protoc-gen-validate/validate expects import "github.com/lyft/protoc-gen-validate/validate"

dnephin commented 4 years ago

Thank you for the bug report!

It looks like the project was moved on github from the lyft org to the envoyproxy org. https://github.com/lyft/protoc-gen-validate redirects to https://github.com/envoyproxy/protoc-gen-validate

https://github.com/envoyproxy/protoc-gen-validate/pull/161 renamed the imports. We will need to update a few dependencies together to pick up those changes.

One workaround is to enable go modules. I tried the go get with go1.13.11 and go modules enabled (GO111MODULE=on) and it worked correctly.

onlyjob commented 4 years ago

In order to fix the build I had to apply the following patch:

--- a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.proto
+++ b/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.proto
@@ -1,8 +1,8 @@
 syntax = "proto2";
 package validate;

-option go_package = "github.com/lyft/protoc-gen-validate/validate";
+option go_package = "github.com/envoyproxy/protoc-gen-validate/validate";
 option java_package = "com.lyft.pgv.validate";

 import "google/protobuf/descriptor.proto";
 import "google/protobuf/duration.proto";
--- a/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.pb.go
+++ b/vendor/github.com/envoyproxy/protoc-gen-validate/validate/validate.pb.go
@@ -1,8 +1,8 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // source: validate/validate.proto

-package validate // import "github.com/lyft/protoc-gen-validate/validate"
+package validate // import "github.com/envoyproxy/protoc-gen-validate/validate"

 import proto "github.com/golang/protobuf/proto"
 import fmt "fmt"
 import math "math"