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: list errors for import is a program, not an importable package #61857

Closed
andig opened this issue Aug 8, 2023 · 6 comments
Closed

cmd/go: list errors for import is a program, not an importable package #61857

andig opened this issue Aug 8, 2023 · 6 comments
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@andig
Copy link
Contributor

andig commented Aug 8, 2023

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

$ go version
go version go1.21.0 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='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/andig/htdocs/evcc/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sv/rs_453y57xj86xsbz3kw1mbc0000gn/T/go-build977151873=/tmp/go-build -gno-record-gcc-switches -fno-common'
uname -v: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:19 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8103
ProductName:		macOS
ProductVersion:		13.4.1
ProductVersionExtra:	(c)
BuildVersion:		22F770820d
lldb --version: lldb-1403.0.17.67
Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)

What did you do?

Install build tools from tools.go:

go install $(go list -f '{{join .Imports " "}}' tools.go)

What did you expect to see?

No error

What did you see instead?

go list errors:

tools.go:6:2: import "github.com/dmarkham/enumer" is a program, not an importable package

I realise this might not be a bug per se but it is a change of behavior over go1.20.

@seankhliao seankhliao changed the title cmd/go: import "github.com/dmarkham/enumer" is a program, not an importable package cmd/go: list errors for import is a program, not an importable package Aug 8, 2023
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Aug 8, 2023
@seankhliao
Copy link
Member

note that the -e flag is available

@andig
Copy link
Contributor Author

andig commented Aug 8, 2023

Thank you, wasn't even aware of this flag: -e works when used with -f.

@bcmills
Copy link
Member

bcmills commented Aug 8, 2023

Duplicate of #59186

@bcmills bcmills marked this as a duplicate of #59186 Aug 8, 2023
@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2023
@andig
Copy link
Contributor Author

andig commented Aug 9, 2023

@bcmills not quite sure why this is marked as duplicate. From what I understand the reasoning is that:

  • main packages should never have been allowed by go list
  • these errors were not consistently reported in the past (and are not reported consistently today or the referenced issue would not be open- although it seems to relate to -test only?)
  • -e allows proceeding anyway to workaround is in place.

Please correct me (only if wrong). Thank you!

@bcmills
Copy link
Member

bcmills commented Aug 9, 2023

  • these errors were not consistently reported in the past (and are not reported consistently today or the referenced issue would not be open- although it seems to relate to -test only?)

The errors were previously not reported consistently. For some unknown reason, the code changes for -pgo=auto in 1.21 cause them to be reported in cases where they were previously not diagnosed.

#59186 is still open because we still don't understand why the errors were previously not reported, and we still don't know whether there are causes where they remain unreported today.

meling added a commit to quickfeed/quickfeed that referenced this issue Jan 20, 2024
Seems like the way we use the go list command has changed behavior;
see this issue golang/go#61857
@nizarennciri
Copy link

I have the same err and I can fix him ,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go 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