etcd-io / etcd

Distributed reliable key-value store for the most critical data of a distributed system
https://etcd.io
Apache License 2.0
47.93k stars 9.79k forks source link

'go install' etcdctl fails on upstream dependency #18501

Open cringdahl opened 3 months ago

cringdahl commented 3 months ago

Bug report criteria

What happened?

When running go install go.etcd.io/etcd/etcdctl@v3, go successfully finds upstream module dependencies, until it doesn't. It seems to be a dependency for v2, which is included by default.

$ go install go.etcd.io/etcd/etcdctl@v3
go: finding module for package github.com/coreos/etcd/etcdctl/ctlv2
go: finding module for package github.com/coreos/etcd/etcdctl/ctlv3
go: found github.com/coreos/etcd/etcdctl/ctlv2 in github.com/coreos/etcd v3.3.27+incompatible
go: found github.com/coreos/etcd/etcdctl/ctlv3 in github.com/coreos/etcd v3.3.27+incompatible
go: finding module for package github.com/gogo/protobuf/proto
go: finding module for package github.com/urfave/cli
go: finding module for package github.com/bgentry/speakeasy
go: finding module for package github.com/spf13/pflag
go: finding module for package github.com/spf13/cobra
go: finding module for package github.com/coreos/go-semver/semver
go: finding module for package github.com/coreos/bbolt
go: finding module for package github.com/dustin/go-humanize
go: finding module for package github.com/olekukonko/tablewriter
go: finding module for package golang.org/x/time/rate
go: finding module for package google.golang.org/grpc/grpclog
go: finding module for package gopkg.in/cheggaaa/pb.v1
go: finding module for package github.com/json-iterator/go
go: finding module for package github.com/modern-go/reflect2
go: finding module for package github.com/gogo/protobuf/gogoproto
go: finding module for package github.com/golang/protobuf/proto
go: finding module for package google.golang.org/genproto/googleapis/api/annotations
go: finding module for package google.golang.org/grpc
go: finding module for package google.golang.org/grpc/codes
go: finding module for package google.golang.org/grpc/status
go: finding module for package github.com/coreos/pkg/capnslog
go: finding module for package github.com/prometheus/client_golang/prometheus
go: finding module for package github.com/google/uuid
go: finding module for package go.uber.org/zap
go: finding module for package google.golang.org/grpc/credentials
go: finding module for package google.golang.org/grpc/keepalive
go: finding module for package google.golang.org/grpc/metadata
go: finding module for package github.com/google/btree
go: finding module for package github.com/jonboulle/clockwork
go: finding module for package google.golang.org/grpc/balancer
go: finding module for package google.golang.org/grpc/connectivity
go: finding module for package google.golang.org/grpc/resolver
go: finding module for package google.golang.org/grpc/resolver/dns
go: finding module for package google.golang.org/grpc/resolver/passthrough
go: finding module for package go.uber.org/zap/zapcore
go: finding module for package github.com/coreos/go-systemd/journal
go: finding module for package github.com/dgrijalva/jwt-go
go: finding module for package golang.org/x/crypto/bcrypt
go: finding module for package google.golang.org/grpc/peer
go: finding module for package github.com/xiang90/probing
go: found github.com/urfave/cli in github.com/urfave/cli v1.22.15
go: found github.com/spf13/cobra in github.com/spf13/cobra v1.8.1
go: found github.com/spf13/pflag in github.com/spf13/pflag v1.0.5
go: found github.com/bgentry/speakeasy in github.com/bgentry/speakeasy v0.2.0
go: found github.com/coreos/bbolt in github.com/coreos/bbolt v1.3.11
go: found github.com/coreos/go-semver/semver in github.com/coreos/go-semver v0.3.1
go: found github.com/dustin/go-humanize in github.com/dustin/go-humanize v1.0.1
go: found github.com/gogo/protobuf/proto in github.com/gogo/protobuf v1.3.2
go: found github.com/olekukonko/tablewriter in github.com/olekukonko/tablewriter v0.0.5
go: found golang.org/x/time/rate in golang.org/x/time v0.6.0
go: found google.golang.org/grpc/grpclog in google.golang.org/grpc v1.65.0
go: found gopkg.in/cheggaaa/pb.v1 in gopkg.in/cheggaaa/pb.v1 v1.0.28
go: found github.com/json-iterator/go in github.com/json-iterator/go v1.1.12
go: found github.com/modern-go/reflect2 in github.com/modern-go/reflect2 v1.0.2
go: found github.com/gogo/protobuf/gogoproto in github.com/gogo/protobuf v1.3.2
go: found github.com/golang/protobuf/proto in github.com/golang/protobuf v1.5.4
go: found google.golang.org/genproto/googleapis/api/annotations in google.golang.org/genproto/googleapis/api v0.0.0-20240823204242-4ba0660f739c
go: found google.golang.org/grpc in google.golang.org/grpc v1.65.0
go: found google.golang.org/grpc/codes in google.golang.org/grpc v1.65.0
go: found google.golang.org/grpc/status in google.golang.org/grpc v1.65.0
go: found github.com/coreos/pkg/capnslog in github.com/coreos/pkg v0.0.0-20240122114842-bbd7aa9bf6fb
go: found github.com/prometheus/client_golang/prometheus in github.com/prometheus/client_golang v1.20.2
go: found github.com/google/uuid in github.com/google/uuid v1.6.0
go: found go.uber.org/zap in go.uber.org/zap v1.27.0
go: found google.golang.org/grpc/credentials in google.golang.org/grpc v1.65.0
go: found google.golang.org/grpc/keepalive in google.golang.org/grpc v1.65.0
go: found google.golang.org/grpc/metadata in google.golang.org/grpc v1.65.0
go: found github.com/google/btree in github.com/google/btree v1.1.3
go: found github.com/jonboulle/clockwork in github.com/jonboulle/clockwork v0.4.0
go: found google.golang.org/grpc/balancer in google.golang.org/grpc v1.65.0
go: found google.golang.org/grpc/connectivity in google.golang.org/grpc v1.65.0
go: found google.golang.org/grpc/resolver in google.golang.org/grpc v1.65.0
go: found google.golang.org/grpc/resolver/dns in google.golang.org/grpc v1.65.0
go: found google.golang.org/grpc/resolver/passthrough in google.golang.org/grpc v1.65.0
go: found go.uber.org/zap/zapcore in go.uber.org/zap v1.27.0
go: found github.com/coreos/go-systemd/journal in github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
go: found github.com/dgrijalva/jwt-go in github.com/dgrijalva/jwt-go v3.2.0+incompatible
go: found golang.org/x/crypto/bcrypt in golang.org/x/crypto v0.26.0
go: found google.golang.org/grpc/peer in google.golang.org/grpc v1.65.0
go: found github.com/xiang90/probing in github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510
go: go.etcd.io/etcd/etcdctl imports
    github.com/coreos/etcd/etcdctl/ctlv2 imports
    github.com/coreos/etcd/etcdctl/ctlv2/command imports
    github.com/coreos/bbolt: github.com/coreos/bbolt@v1.3.11: parsing go.mod:
    module declares its path as: go.etcd.io/bbolt
            but was required as: github.com/coreos/bbolt

What did you expect to happen?

I expected go install go.etcd.io/etcd/etcdctl@v3 to install etcdctl.

How can we reproduce it (as minimally and precisely as possible)?

Run go install go.etcd.io/etcd/etcdctl@v3. I ran into this on macOS 14.6.1 with go1.23.0, and tested again on an ubuntu:latest container running go1.22.2

Anything else we need to know?

No response

Etcd version (please run commands below)

N/A, etcd not installed

Etcd configuration (command line flags or environment variables)

N/A, etcd not installed

Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)

N/A, etcd not installed

Relevant log output

No response

ahrtr commented 3 months ago

It should be a known issue. It doesn't work because the go.mod file contains replace directive. Refer to https://go.dev/ref/mod#go-install.

$ go install go.etcd.io/etcd/etcdctl/v3@v3.5.15
go: go.etcd.io/etcd/etcdctl/v3@v3.5.15 (in go.etcd.io/etcd/etcdctl/v3@v3.5.15):
    The go.mod file for the module providing named packages contains one or
    more replace directives. It must not contain directives that would cause
    it to be interpreted differently than if it were the main module.

After we switch to go workspace, it should can resolve this. @ivanvc

ahrtr commented 3 months ago

See https://github.com/etcd-io/etcd/issues/18409

ArkaSaha30 commented 2 months ago

/triaged

ArkaSaha30 commented 2 months ago

/triaged-accepted

ArkaSaha30 commented 2 months ago

/triage-accepted

ivanvc commented 2 months ago

We were testing the prow to see if it would add the stage/triaged label :sweat_smile:.

Discussed during our fortnightly triage meeting. This issue will likely be closed by implementing the Go workspace for v3.6. As per backporting this into v3.5, we're far from confirming whether we'll do it. We'll keep this issue in the meanwhile.