Ask questionscmd/go: "found, but does not contain package" error refers to replaced version instead of its replacement

<!-- Please answer these questions before submitting your issue. Thanks! -->

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

<pre> $ go version go version go1.13 darwin/amd64 </pre>

Does this issue reproduce with the latest release?


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

<details><summary><code>go env</code> Output</summary><br><pre> $ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/rajagast/Library/Caches/go-build" GOENV="/Users/rajagast/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GONOPROXY="none" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/rajagast/go" GOPRIVATE="" GOPROXY="" GOROOT="/usr/local/Cellar/go/1.13/libexec" GOSUMDB="" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.13/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/rajagast/go/src/" 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/d0/18x8fk8571v3t2p12n8r340h0000gn/T/go-build223406614=/tmp/go-build -gno-record-gcc-switches -fno-common" </pre></details>

What did you do?

I have as a tools dependency i.e. I have a top-level tools.go file with these contents:

// +build tools

package tools

import (
	_ ""
	_ ""
	_ ""
	_ ""
	_ ""
	_ ""
	_ ""

I also have one private dependency, so according to go1.13 I'm setting appropriate env variables.

$ go env -w GOPROXY= GONOPROXY=none

When I do go mod tidy, I get the following failure which is very vague:

go: finding latest imports module reading 500 Internal Server Error imports tested by imports module reading 500 Internal Server Error

The interesting thing is when I turn off GOPROXY with go env -w "GOPROXY=", it shows a different error:

go: finding latest imports module (v0.0.0-20190831074504-732c9ca86353) found, but does not contain package imports tested by imports module (v0.1.0) found, but does not contain package

The error module (v0.0.0-20190831074504-732c9ca86353) found, but does not contain package is strange because latest code in that repo does contain that package.

Fwiw, this used to work perfectly fine with go1.12.9 yesterday.

This is my go.mod:


go 1.12

require ( v2.7.1+incompatible // indirect v0.0.0-20181023171402-6480d4af844c // indirect v0.0.0-20181111060418-2ce16c963a8a // indirect v4.2.0+incompatible // indirect v1.0.0 // indirect v0.1.0 // indirect v0.1.0 v0.1.0 v1.2.2-0.20190723190241-65acae22fc9d // indirect v0.0.0-20160126235308-23def4e6c14b v0.0.0-20180924190550-6f2cf27854a4 // indirect v1.0.0 // indirect v1.1.1 v0.2.0 // indirect v1.7.1 v0.0.0-20180305231024-9cad4c3443a7 // indirect v0.5.1 // indirect v0.3.6 // indirect v1.1.7 // indirect v0.0.0-20171005235357-81af80346b1a // indirect v1.0.1 // indirect v1.8.0 v1.5.0 v1.0.0-rc1 // indirect v0.0.0-20190613202004-28fc1e342cde // indirect v0.0.0-20180831174519-c2e51be1758e v0.4.1 v1.2.0 v2.0.1+incompatible // indirect v0.8.1 v0.9.2 // indirect v0.0.0-20190129233127-fd36f4220a90 // indirect v0.2.0 // indirect v0.0.0-20190403104016-ea9eea638872 // indirect v0.0.0-00010101000000-000000000000 // indirect v1.3.0 // indirect v1.0.3 // indirect v0.19.0 v1.3.2 // indirect v1.1.0 // indirect v1.9.1 v0.0.0-20190611184440-5c40567a22f8 // indirect v0.0.0-20190812203447-cdfb69ac37fc v0.0.0-20190402181905-9f3314589c9a // indirect v0.0.0-20190616124812-15dcb6c0061f // indirect v0.3.2 // indirect v0.0.0-20180412165947-fbb02b2291d2 // indirect v0.0.0-20190621195816-6e04913cbbac // indirect v1.5.0 // indirect v0.9.1 // indirect v2.2.2 // indirect v0.0.0-20190704094930-781da4e7b28a v0.0.0-20190704104408-4c62af35d786 v0.0.0-20190704094625-facf06a8f4b8 v0.0.0-20190704101201-5341ddeccec6 // indirect v10.0.0+incompatible v0.0.0-20190704110328-86aca54c9e62 v0.0.0-20190704094322-1ed9df051d9b v0.0.0-20190826232639-a874a240740c // indirect v0.4.0 // indirect v0.0.0-20190816220812-743ec37842bf // indirect v0.0.0-20190704105642-5b7f4f839816 // indirect v0.0.0-20190704105832-d6717358a5ca // indirect v1.13.5 v0.0.0-20190607212802-c55fbcfc754a // indirect v0.1.9 v0.1.1 // indirect v0.0.2-0.20190614085909-34571ec5f0c5

replace ( => v1.1.0 => v0.0.0-20190704094322-1ed9df051d9b

What did you expect to see?

go mod tidy resolve dependencies correctly without error, as it did with go1.12.9.

What did you see instead?

Two issues:

  1. go mod tidy says packages do not exist when they are indeed present.
  2. When GOPROXY is set, it errors out without any meaningful message.

Answer questions heschi

It's clearly true that kubernetes-drain depends on a package in log that doesn't exist at the latest tagged version, v0.1.0. So it seems reasonable that 1.13 is unhappy; perhaps it was a bug in 1.12 that it didn't notice. Generally speaking, if go mod tidy notices that there is a package missing, it will try to upgrade to the latest version of the module to see if it exists, but in this case there is no tagged version that contains the capture package. I'd suggest forcing an upgrade by replacing v0.1.0 with master in your go.mod to tell the Go command to use the latest commit rather than the latest tagged version.

@bcmills to confirm that this is all WAI.

Github User Rank List