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: mod why should ignore missing standard library packages #47152

Closed
sgnn7 opened this issue Jul 12, 2021 · 1 comment
Closed

cmd/go: mod why should ignore missing standard library packages #47152

sgnn7 opened this issue Jul 12, 2021 · 1 comment

Comments

@sgnn7
Copy link

sgnn7 commented Jul 12, 2021

When using go mod why, a dependency that uses stdlib packages from newer Golang should not break the command.

Note: This is a follow-up to #44557 which only fixes the mod tidy and mod vendor. Preference for 1.15 backport inclusion.

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

go version go1.15.13

Does this issue reproduce with the latest release?

Yes with latest 1.15 version (1.15.13)

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

Not relevant to bug but click here if interested
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/user/Library/Caches/go-build"
GOENV="/Users/user/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/user/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go@1.15/1.15.13/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go@1.15/1.15.13/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/user/checkout/tmp/test/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/l8/t64gtkc53c72qnfkqztd3fsh0000gn/T/go-build948065794=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ go version
go version go1.15.13 darwin/amd64
                                   
$ go mod init github.com/sgnn7/test
go: creating new go.mod: module github.com/sgnn7/test

$  go get github.com/spf13/afero@v1.6.0

main.go:

package main

import "github.com/spf13/afero"

func main() {
        var AppFs = afero.NewMemMapFs()
        fmt.Println(AppFs)
}

go mod why:

$ go mod why github.com/spf13/afero
github.com/sgnn7/test imports
        github.com/spf13/afero imports
        io/fs: package io/fs is not in GOROOT (/usr/local/Cellar/go@1.15/1.15.13/libexec/src/io/fs)
github.com/sgnn7/test imports
        github.com/spf13/afero tested by
        github.com/spf13/afero.test imports
        testing/fstest: package testing/fstest is not in GOROOT (/usr/local/Cellar/go@1.15/1.15.13/libexec/src/testing/fstest)

What did you expect to see?

Package name and version

What did you see instead?

Error (see above)

@jayconrod
Copy link
Contributor

I tried this out with go1.16.5 with a test module that imports a package in another module that imports a non-existent standard library package. It looks like this works fine in that version: go mod why reports no error.

I don't believe this meets the criteria for backporting, so I'll close this. Sorry, I know this is annoying.

cc @bcmills @matloob

@golang golang locked and limited conversation to collaborators Jul 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants