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

x/exp/cmd/gorelease: requirements are incomplete #38164

Closed
carnott-snap opened this issue Mar 30, 2020 · 7 comments
Closed

x/exp/cmd/gorelease: requirements are incomplete #38164

carnott-snap opened this issue Mar 30, 2020 · 7 comments
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@carnott-snap
Copy link

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

$ go version
go version go1.14.1 linux/amd64

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="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOOS="linux"
GOPATH="/home/user/go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/user/.local/share/umake/go/go-lang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/.local/share/umake/go/go-lang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build393300957=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go get golang.org/x/exp/cmd/gorelease
go mod tidy
gorelease 

What did you expect to see?

Suggested version: v2.0.2 (with tag v2.0.2)

What did you see instead?

Inferred base version: v2.0.1
go.mod: requirements are incomplete.
Run 'go mod tidy' to add missing requirements.
@gopherbot gopherbot added this to the Unreleased milestone Mar 30, 2020
@jayconrod
Copy link
Contributor

Could you say more about your project's structure? Does go mod tidy make any changes to your go.mod file? Do you have any replace or exclude directives? If you have a minimal reproducible example, that would be helpful.

gorelease loads all the packages in the module as if it were not the main module (ignoring replace or exclude directives). If something imports a package that is not provided by any module in the build list, gorelease will report this error.

@jayconrod jayconrod added modules Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Mar 30, 2020
@carnott-snap
Copy link
Author

Unfortunately the specific module is closed source and a little complex, happy to debug things manually till I can extract a reproducer.

The affected module is a submodule, and it contins a number of packages including an internal, and _examples. It is currently tagged at sub/v2.0.1. go mod tidy does not make any changes and exits with status 0. It does not contain any replace or exclude directives.

@jayconrod
Copy link
Contributor

It might have something to do with the _examples directory, though I'm not sure what. That would be ignored by go list ./..., which is close to what gorelease uses to build a package list. It should also be ignored by go mod tidy though.

@carnott-snap
Copy link
Author

carnott-snap commented Mar 31, 2020

I have narrowed down the root cause, but still cannot reproduce it outside the repo. It appears to relate to a single test import that only exists in one xxx_test.go file. When that import statement is removed (along with the references) gorelease works.

Is there some debugging I can do to diff the list that go mod tidy does with gorelease?

@carnott-snap
Copy link
Author

carnott-snap commented Apr 1, 2020

Further investigation suggests that it is an interaction between this dependency and a previous release of the current module, both of which were untidy (missing h1s from go.sum). This would explain why go mod tidy does nothing, the real ask is to mod tidy a previous release.

What is the general recovery strategy for "gorelease cannot process of the previous release"? It would be nice to be able to diff the old api, but I get that some failures are too systemic.

@jayconrod
Copy link
Contributor

It appears to relate to a single test import that only exists in one xxx_test.go file.

Very strange. I don't think gorelease loads tests, so this shouldn't cause new requirements to be added to go.mod.

There's not a direct way to debug this, but the relevant function in gorelease is loadPackages.

Further investigation suggests that it is an interaction between this dependency and a previous release of the current module, both of which were untidy (missing h1s from go.sum). This would explain why go mod tidy does nothing, the real ask is to mod tidy a previous release.

This shouldn't cause an issue. Only the go.sum file for the main module matters; the go command ignores other go.sum files. And in any case, this error is only shown if a require line is added to go.mod during the loading process, and only for the release version (the checked out code).

Clearly a needed improvement is that gorelease should say which requirements are added or updated.

But it still sounds like since go mod tidy doesn't make any change to go.mod, this error shouldn't be happening at all.

@jayconrod jayconrod added NeedsFix The path to resolution is known, but the work has not been done. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 31, 2020
@gopherbot
Copy link

Change https://golang.org/cl/253039 mentions this issue: x/exp/cmd/gorelease: specify which incomplete requirements were missing

@golang golang locked and limited conversation to collaborators Sep 15, 2021
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. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants