You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GOROOT=C:\Program Files\Go
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set CGO_CFLAGS=-O2 -g
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\UserName\AppData\Local\Temp\go-build144073124=/tmp/go-build -gno-record-gcc-switches
What did you do?
I added "github.com/inancgumus/screen" to my imports in the Go source code.
I ran the command go get github.com/inancgumus/screen.
What did you expect to see?
I expected that "github.com/inancgumus/screen" would appear as a direct dependency in the go.mod file.
What did you see instead?
After running the go get command, the following line appeared in the go.mod file: require github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3 // indirect
However, after running go mod tidy, the "indirect" marking was removed.
Could you please advise if this is the expected behavior? If this is actually expected and is not a bug, I apologize for any misunderstanding. Thank you for your assistance.
The text was updated successfully, but these errors were encountered:
changed the title
affected/package: mod Package shows as "indirect" in go.mod after being fetched with go get as a direct dependency
cmd/go: module shows as "indirect" in go.mod after being fetched with go get as a direct dependency
Jul 20, 2023
Could you please advise if this is the expected behavior?
Yes, this is expected. When you run go get github.com/inancgumus/screen, it loads only the package you requested and the packages it transitively imports. That command doesn't have enough information to know whether you actually added an import of that package.
If you would like the new packages to be marked direct from the start, you can use go get -t ./... instead of go get github.com/inancgumus/screen. That will add any packages needed for go test ./... to succeed, and — because those dependencies are found by scanning the imports of ./... in your module — it will mark them as direct.