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

go get github.com/hashicorp/consul - cannot find multiple imports from envoyproxy/go-control-plane #12555

Closed DrOctavius closed 2 years ago

DrOctavius commented 2 years ago

Hi, i'm trying to download the consul package in my project and use it natively...

Go version: go version go1.17.6 windows/amd64

When running go get github.com/hashicorp/consul i get:

github.com/hashicorp/consul imports github.com/hashicorp/consul/command imports github.com/hashicorp/consul/command/connect/envoy imports github.com/hashicorp/consul/agent/xds imports github.com/envoyproxy/go-control-plane/envoy/config/filter/udp/dns_filter/v2alpha: cannot find module providing package github.com/envoyproxy/go-control-plane/envoy/config/filter/udp/dns_filter/v2alpha github.com/hashicorp/consul imports github.com/hashicorp/consul/command imports github.com/hashicorp/consul/command/connect/envoy imports github.com/hashicorp/consul/agent/xds imports github.com/envoyproxy/go-control-plane/envoy/config/wasm/v2alpha: cannot find module providing package github.com/envoyproxy/go-control-plane/envoy/config/wasm/v2alpha github.com/hashicorp/consul imports github.com/hashicorp/consul/command imports github.com/hashicorp/consul/command/connect/envoy imports github.com/hashicorp/consul/agent/xds imports github.com/envoyproxy/go-control-plane/envoy/extensions/filter/udp/dns_filter/v3alpha: cannot find module providing package github.com/envoyproxy/go-control-plane/envoy/extensions/filter/udp/dns_filter/v3alpha github.com/hashicorp/consul imports github.com/hashicorp/consul/command imports github.com/hashicorp/consul/command/connect/envoy imports github.com/hashicorp/consul/agent/xds imports github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/cache/v3alpha: cannot find module providing package github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/cache/v3alpha github.com/hashicorp/consul imports github.com/hashicorp/consul/command imports github.com/hashicorp/consul/command/connect/envoy imports github.com/hashicorp/consul/agent/xds imports github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/squash/v3: cannot find module providing package github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/squash/v3 github.com/hashicorp/consul imports github.com/hashicorp/consul/command imports github.com/hashicorp/consul/command/connect/envoy imports github.com/hashicorp/consul/agent/xds imports github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/kafka_broker/v3: cannot find module providing package github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/kafka_broker/v3 github.com/hashicorp/consul imports github.com/hashicorp/consul/command imports github.com/hashicorp/consul/command/connect/envoy imports github.com/hashicorp/consul/agent/xds imports github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/mysql_proxy/v3: cannot find module providing package github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/mysql_proxy/v3

I have checked envoyproxy/go-control-plane and multiple forlders have been removed, renamed or moved. Is there a temporary solution for this?

kisunji commented 2 years ago

Could you explain the use-case for go get-ing Consul? I tried this locally in a Go-module-aware context and it worked fine:

> go version
go version go1.17.5 windows/amd64
> go get github.com/hashicorp/consul
go: downloading github.com/hashicorp/consul v1.11.4
go: downloading github.com/mitchellh/cli v1.1.0
go: downloading golang.org/x/sys v0.0.0-20211013075003-97ac67df715c
go: downloading github.com/armon/go-metrics v0.3.10
go: downloading github.com/hashicorp/go-uuid v1.0.2
go: downloading github.com/hashicorp/serf v0.9.7
go: downloading github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493
go: downloading github.com/mitchellh/copystructure v1.0.0
go: downloading github.com/mitchellh/mapstructure v1.4.1-0.20210112042008-8ebf2d61a8b4
go: downloading github.com/mitchellh/reflectwalk v1.0.1
go: downloading github.com/armon/go-radix v1.0.0
go: downloading github.com/bgentry/speakeasy v0.1.0
go: downloading github.com/fatih/color v1.9.0
go: downloading github.com/posener/complete v1.2.3
go: downloading github.com/hashicorp/consul/api v1.11.0
go: downloading github.com/hashicorp/go-bexpr v0.1.2
go: downloading github.com/hashicorp/go-connlimit v0.3.0
go: downloading github.com/hashicorp/go-hclog v0.14.1
go: downloading github.com/hashicorp/go-memdb v1.3.1
go: downloading github.com/hashicorp/go-msgpack v0.5.5
go: downloading github.com/hashicorp/go-multierror v1.1.0
go: downloading github.com/hashicorp/go-raftchunking v0.6.1
go: downloading github.com/hashicorp/go-version v1.2.1
go: downloading github.com/hashicorp/memberlist v0.3.1
go: downloading github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69
go: downloading github.com/hashicorp/raft v1.3.5
go: downloading github.com/hashicorp/raft-autopilot v0.1.5
go: downloading github.com/hashicorp/raft-boltdb/v2 v2.2.0
go: downloading github.com/mitchellh/hashstructure/v2 v2.0.2
go: downloading github.com/hashicorp/raft-boltdb v0.0.0-20211202195631-7d34b9fb3f42
go: downloading github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452
go: downloading go.etcd.io/bbolt v1.3.5
go: downloading golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
go: downloading google.golang.org/grpc v1.25.1
go: downloading github.com/kr/text v0.1.0
go: downloading github.com/hashicorp/go-checkpoint v0.5.0
go: downloading github.com/ryanuber/columnize v2.1.0+incompatible
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/hashicorp/go-sockaddr v1.0.2
go: downloading github.com/hashicorp/consul/sdk v0.8.0
go: downloading github.com/rboyer/safeio v0.2.1
go: downloading github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible
go: downloading github.com/prometheus/client_golang v1.4.0
go: downloading github.com/DataDog/datadog-go v3.2.0+incompatible
go: downloading github.com/mattn/go-colorable v0.1.6
go: downloading github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e
go: downloading github.com/docker/go-connections v0.3.0
go: downloading github.com/hashicorp/go-cleanhttp v0.5.1
go: downloading golang.org/x/net v0.0.0-20211209124913-491a49abca63
go: downloading github.com/mitchellh/go-testing-interface v1.14.0
go: downloading github.com/aws/aws-sdk-go v1.25.41
go: downloading github.com/hashicorp/vault/api v1.0.5-0.20200717191844-f687267c8086
go: downloading gopkg.in/square/go-jose.v2 v2.5.1
go: downloading k8s.io/api v0.18.2
go: downloading k8s.io/apimachinery v0.18.2
go: downloading k8s.io/client-go v0.18.2
go: downloading github.com/pkg/errors v0.8.1
go: downloading github.com/miekg/dns v1.1.41
go: downloading golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
go: downloading github.com/hashicorp/hil v0.0.0-20200423225030-a18a1cd20038
go: downloading github.com/hashicorp/go-syslog v1.0.0
go: downloading github.com/golang/protobuf v1.3.5
go: downloading github.com/hashicorp/go-rootcerts v1.0.2
go: downloading github.com/hashicorp/errwrap v1.0.0
go: downloading github.com/google/btree v1.0.0
go: downloading github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
go: downloading github.com/boltdb/bolt v1.3.1
go: downloading github.com/NYTimes/gziphandler v1.0.1
go: downloading github.com/coredns/coredns v1.1.2
go: downloading github.com/hashicorp/go-discover v0.0.0-20210818145131-c573d69da192
go: downloading github.com/imdario/mergo v0.3.6
go: downloading github.com/shirou/gopsutil/v3 v3.21.10
go: downloading github.com/envoyproxy/go-control-plane v0.9.5
go: downloading google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
go: downloading github.com/circonus-labs/circonusllhist v0.1.3
go: downloading github.com/hashicorp/go-retryablehttp v0.6.7
go: downloading github.com/prometheus/common v0.9.1
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/prometheus/procfs v0.0.8
go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/Microsoft/go-winio v0.4.3
go: downloading github.com/hashicorp/vault/sdk v0.1.14-0.20200519221838-e0cfd64bc267
go: downloading github.com/stretchr/objx v0.1.1
go: downloading github.com/google/gofuzz v1.2.0
go: downloading k8s.io/klog v1.0.0
go: downloading github.com/coreos/go-oidc v2.1.0+incompatible
go: downloading github.com/mitchellh/pointerstructure v1.0.0
go: downloading github.com/patrickmn/go-cache v2.1.0+incompatible
go: downloading golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0
go: downloading github.com/StackExchange/wmi v1.2.1
go: downloading github.com/cncf/udpa/go v0.0.0-20200313221541-5f7e5dd04533
go: downloading github.com/envoyproxy/protoc-gen-validate v0.1.0
go: downloading github.com/census-instrumentation/opencensus-proto v0.2.1
go: downloading github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading sigs.k8s.io/structured-merge-diff/v3 v3.0.0
go: downloading gopkg.in/inf.v0 v0.9.1
go: downloading github.com/googleapis/gnostic v0.2.0
go: downloading k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89
go: downloading github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35
go: downloading github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af
go: downloading github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0
go: downloading github.com/tklauser/go-sysconf v0.3.9
go: downloading github.com/denverdino/aliyungo v0.0.0-20170926055100-d3308649c661
go: downloading github.com/Azure/azure-sdk-for-go v44.0.0+incompatible
go: downloading github.com/Azure/go-autorest/autorest v0.11.0
go: downloading github.com/Azure/go-autorest v14.2.0+incompatible
go: downloading github.com/Azure/go-autorest/autorest/azure/auth v0.5.0
go: downloading github.com/digitalocean/godo v1.10.0
go: downloading google.golang.org/api v0.9.0
go: downloading github.com/linode/linodego v0.7.1
go: downloading github.com/hashicorp/mdns v1.0.4
go: downloading github.com/gophercloud/gophercloud v0.1.0
go: downloading github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c
go: downloading github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2
go: downloading github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d
go: downloading github.com/tencentcloud/tencentcloud-sdk-go v1.0.162
go: downloading github.com/joyent/triton-go v1.7.1-0.20200416154420-6801d15b779f
go: downloading github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443
go: downloading github.com/vmware/govmomi v0.18.0
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/go-ole/go-ole v1.2.6
go: downloading github.com/golang/snappy v0.0.1
go: downloading github.com/pierrec/lz4 v2.5.2+incompatible
go: downloading github.com/ryanuber/go-glob v1.0.0
go: downloading google.golang.org/appengine v1.6.0
go: downloading github.com/tklauser/numcpus v0.3.0
go: downloading github.com/Azure/go-autorest/autorest/adal v0.9.0
go: downloading github.com/Azure/go-autorest/logger v0.2.0
go: downloading github.com/Azure/go-autorest/tracing v0.6.0
go: downloading github.com/Azure/go-autorest/autorest/azure/cli v0.4.0
go: downloading github.com/dimchansky/utfbom v1.1.0
go: downloading cloud.google.com/go v0.38.0
go: downloading github.com/google/go-querystring v1.0.0
go: downloading gopkg.in/resty.v1 v1.12.0
go: downloading github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03
go: downloading sigs.k8s.io/yaml v1.2.0
go: downloading github.com/Azure/go-autorest/autorest/date v0.3.0
go: downloading github.com/dgrijalva/jwt-go v3.2.0+incompatible
go: downloading github.com/googleapis/gax-go/v2 v2.0.5
go: downloading go.opencensus.io v0.22.0
go: downloading github.com/sirupsen/logrus v1.4.2
go: downloading github.com/konsorten/go-windows-terminal-sequences v1.0.2
go: downloading github.com/Azure/go-autorest/autorest/validation v0.3.0
go: downloading github.com/Azure/go-autorest/autorest/to v0.4.0
go get: installing executables with 'go get' in module mode is deprecated.
        Use 'go install pkg@version' instead.
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.
# github.com/hashicorp/consul/command/flags
..\..\go\pkg\mod\github.com\hashicorp\consul@v1.11.4\command\flags\http.go:157:22: c.Partition undefined (type *api.Config has no field or method Partition)
# github.com/hashicorp/consul/agent/structs
..\..\go\pkg\mod\github.com\hashicorp\consul@v1.11.4\agent\structs\connect_proxy_config.go:478:3: unknown field 'DestinationPartition' in struct literal of type api.Upstream
..\..\go\pkg\mod\github.com\hashicorp\consul@v1.11.4\agent\structs\connect_proxy_config.go:582:26: u.DestinationPartition undefined (type api.Upstream has no field or method DestinationPartition)
# github.com/hashicorp/consul/command/kv/impexp
..\..\go\pkg\mod\github.com\hashicorp\consul@v1.11.4\command\kv\impexp\kvimpexp.go:23:18: pair.Partition undefined (type *api.KVPair has no field or method Partition)

The undefined errors above are a known issue that https://github.com/hashicorp/consul/pull/12549 will solve

We generally do not recommend it since Consul is not a library to import. We have Go modules consul/api and consul/sdk which may be what you are looking for.

kisunji commented 2 years ago

Closing as I'm unable to replicate on Windows. Consider trying go install instead if you plan to import github.com/hashicorp/consul in a go module project.

GuillaumeRochat commented 2 years ago

We generally do not recommend it since Consul is not a library to import. We have Go modules consul/api and consul/sdk which may be what you are looking for.

What about Consul Connect Native as shown in https://www.consul.io/docs/connect/native/go ?

That one seems to require Consul as a library, is it no recommended?