Skip to content

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

Closed
@rhysh

Description

@rhysh

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

Activity

bcmills

bcmills commented on Dec 5, 2019

@bcmills
Contributor

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

added
NeedsFixThe path to resolution is known, but the work has not been done.
on Dec 5, 2019
added this to the Go1.14 milestone on Dec 5, 2019
self-assigned this
on Dec 5, 2019
gopherbot

gopherbot commented on Dec 6, 2019

@gopherbot
Contributor

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

gopherbot

gopherbot commented on Dec 6, 2019

@gopherbot
Contributor

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

locked and limited conversation to collaborators on Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.modules

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jayconrod@rhysh@bcmills@gopherbot

        Issue actions

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