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

go/build: TestMissingImportErrorRepetition fails based on GONOPROXY and GOPRIVATE #35986

Closed
rhysh opened this issue Dec 5, 2019 · 3 comments
Closed
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rhysh
Copy link
Contributor

rhysh commented Dec 5, 2019

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

$ go-tip version
go version devel +9a8b497240 Thu Dec 5 02:00:50 2019 +0000 darwin/amd64

Does this issue reproduce with the latest release?

This is present in tip, not in go1.13.3.

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

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/rhys/Library/Caches/go-build"
GOENV="/Users/rhys/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY="*"
GONOSUMDB="*"
GOOS="darwin"
GOPATH="/Users/rhys/go"
GOPRIVATE="*"
GOPROXY="direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/49/zmds5zsn75z1283vtzxyfr5hj7yjq4/T/go-build076155176=/tmp/go-build -gno-record-gcc-switches -fno-common"

The important part of that output is that I have GONOPROXY and GOPRIVATE set to *.

What did you do?

I ran (cd ./src && ./all.bash) with GONOPROXY="*" and GOPRIVATE="*" in my environment.

What did you expect to see?

I expected all.bash to pass, and for each test to either have the correct results or to be intentionally skipped.

What did you see instead?

When either GONOPROXY or GOPRIVATE is set to *, TestMissingImportErrorRepetition fails.

$ GONOPROXY= GONOSUMDB=* GOPRIVATE= GOPROXY=direct go-tip test go/build -run=TestMissingImportErrorRepetition -count=1
ok  	go/build	0.052s
$ GONOPROXY=* GONOSUMDB=* GOPRIVATE= GOPROXY=direct go-tip test go/build -run=TestMissingImportErrorRepetition -count=1
--- FAIL: TestMissingImportErrorRepetition (0.24s)
    build_test.go:526: package path "example.com/hello" appears in error 3 times; should appear once
        error: cannot find module providing package example.com/hello: unrecognized import path "example.com/hello": reading https://example.com/hello?go-get=1: 404 Not Found
FAIL
FAIL	go/build	0.270s
FAIL
$ GONOPROXY= GONOSUMDB=* GOPRIVATE=* GOPROXY=direct go-tip test go/build -run=TestMissingImportErrorRepetition -count=1
--- FAIL: TestMissingImportErrorRepetition (0.24s)
    build_test.go:526: package path "example.com/hello" appears in error 3 times; should appear once
        error: cannot find module providing package example.com/hello: unrecognized import path "example.com/hello": reading https://example.com/hello?go-get=1: 404 Not Found
FAIL
FAIL	go/build	0.261s
FAIL
$ GONOPROXY=* GONOSUMDB=* GOPRIVATE=* GOPROXY=direct go-tip test go/build -run=TestMissingImportErrorRepetition -count=1
--- FAIL: TestMissingImportErrorRepetition (0.24s)
    build_test.go:526: package path "example.com/hello" appears in error 3 times; should appear once
        error: cannot find module providing package example.com/hello: unrecognized import path "example.com/hello": reading https://example.com/hello?go-get=1: 404 Not Found
FAIL
FAIL	go/build	0.270s
FAIL

The test is new for #34752. Is a short/deduplicated error message right in this case too? CC @bcmills

@bcmills
Copy link
Member

bcmills commented Dec 5, 2019

Thanks for the report. In this case I think the duplication in the https:// URL might not be terrible to retain, but the duplication between cannot find module and unrecognized import path should probably be eliminated.

CC @jayconrod

@bcmills bcmills added modules NeedsFix The path to resolution is known, but the work has not been done. labels Dec 5, 2019
@bcmills bcmills added this to the Go1.14 milestone Dec 5, 2019
@jayconrod jayconrod self-assigned this Dec 5, 2019
@gopherbot
Copy link

Change https://golang.org/cl/210338 mentions this issue: cmd/go: reduce redundancy in direct mode lookup error messages

@gopherbot
Copy link

Change https://golang.org/cl/210342 mentions this issue: cmd/go/internal/modload: revert duplicate path suppression in modload.ImportMissingError

gopherbot pushed a commit that referenced this issue Dec 6, 2019
….ImportMissingError

CL 210338 suppressed duplication for import paths mentioned in an
ImportMissingError.

Unfortunately, that broke one of the cases in
cmd/go/internal/modload.TestImport, and the new error message is still
kind of awkward anyway.

Let's revert that part of the change — we can try again with more
coverage for that case.

Updates #35986

Change-Id: Ib0858aec4f89a7231e32c35ec876da80d80f2098
Reviewed-on: https://go-review.googlesource.com/c/go/+/210342
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
@golang golang locked and limited conversation to collaborators Dec 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants