Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go get removes direct dependency #57683

Closed
andig opened this issue Jan 8, 2023 · 4 comments
Closed

cmd/go: go get removes direct dependency #57683

andig opened this issue Jan 8, 2023 · 4 comments
Assignees
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@andig
Copy link
Contributor

andig commented Jan 8, 2023

What version of Go are you using (go version)?

$ go version
go version go1.19.4 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/andig/Library/Caches/go-build"
GOENV="/Users/andig/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/andig/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/andig/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.19.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.19.4/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/andig/htdocs/evcc/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build4107096655=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version go1.19.4 darwin/arm64
GOROOT/bin/go tool compile -V: compile version go1.19.4
uname -v: Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103
ProductName:		macOS
ProductVersion:		13.1
BuildVersion:		22C65
lldb --version: lldb-1400.0.38.17
Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)

What did you do?

Run go get on clean go.mod:

 evcc master ≡  ❯
go mod tidy

 evcc master ≡  ❯
go get github.com/traefik/yaegi
go: added github.com/traefik/yaegi v0.14.3
go: removed github.com/volkszaehler/mbmd v0.0.0-20221223133217-870b3b92b81e

What did you expect to see?

No removal of unrelated modules

What did you see instead?

mbmd module removed for unknown reason:

diff --git a/go.mod b/go.mod
index b40aa02b1..c377e97fc 100644
--- a/go.mod
+++ b/go.mod
@@ -86,7 +86,6 @@ require (
        github.com/spf13/viper v1.14.0
        github.com/stretchr/testify v1.8.1
        github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c
-       github.com/volkszaehler/mbmd v0.0.0-20221223133217-870b3b92b81e
        github.com/writeas/go-strip-markdown v2.0.1+incompatible
        gitlab.com/bboehmke/sunny v0.15.1-0.20211022160056-2fba1c86ade6
        golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15
@@ -176,6 +175,7 @@ require (
        github.com/spf13/cast v1.5.0 // indirect
        github.com/subosito/gotenv v1.4.1 // indirect
        github.com/teivah/onecontext v1.3.0 // indirect
+       github.com/traefik/yaegi v0.14.3 // indirect
        github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
        github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
        gitlab.com/c0b/go-ordered-json v0.0.0-20201030195603-febf46534d5a // indirect

This happens on evcc-io/evcc@c18475b

Running tidy once more re-adds the removed module:

go mod tidy
go: finding module for package github.com/volkszaehler/mbmd/meters/rs485
go: finding module for package github.com/volkszaehler/mbmd/meters
go: finding module for package github.com/volkszaehler/mbmd/encoding
go: finding module for package github.com/volkszaehler/mbmd/meters/sunspec
go: found github.com/volkszaehler/mbmd/encoding in github.com/volkszaehler/mbmd v0.0.0-20221223133217-870b3b92b81e
go: found github.com/volkszaehler/mbmd/meters/rs485 in github.com/volkszaehler/mbmd v0.0.0-20221223133217-870b3b92b81e
go: found github.com/volkszaehler/mbmd/meters in github.com/volkszaehler/mbmd v0.0.0-20221223133217-870b3b92b81e
go: found github.com/volkszaehler/mbmd/meters/sunspec in github.com/volkszaehler/mbmd v0.0.0-20221223133217-870b3b92b81e
@bcmills bcmills self-assigned this Jan 9, 2023
@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. modules labels Jan 9, 2023
@bcmills bcmills added this to the Go1.21 milestone Jan 9, 2023
@bcmills
Copy link
Contributor

bcmills commented Jan 9, 2023

Thanks for the report. I suspect that this is related to #55955.

@bcmills bcmills added the GoCommand cmd/go label Jan 9, 2023
@zakcutner
Copy link

zakcutner commented Feb 13, 2023

Hello! Is there any known workaround to this? I'm seeing it too: the effect is that this forces me to update the removed modules, since when they are re-added with go mod tidy the latest version is fetched

Edit: in case it helps anyone else, I've found that I can get around this by manually editing the go.mod file with the new dependency/version and then running go mod tidy 🙂

@bcmills
Copy link
Contributor

bcmills commented May 11, 2023

Confirmed, this will be fixed by https://go.dev/cl/471595.

@bcmills
Copy link
Contributor

bcmills commented May 11, 2023

Duplicate of #55955.

@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
@golang golang locked and limited conversation to collaborators May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants