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: install fails to build while build succeeds when using go.work #50036

Closed
hyangah opened this issue Dec 7, 2021 · 3 comments
Closed
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Dec 7, 2021

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

% gotip version
go version devel go1.18-cf1ec17360 Tue Dec 7 21:54:30 2021 +0000 darwin/amd64

Does this issue reproduce with the latest release?

Reproduced with go tip

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

go env Output
 gotip env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hakim/Library/Caches/go-build"
GOENV="/Users/hakim/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/hakim/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/hakim/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/hakim/sdk/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/hakim/sdk/gotip/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="devel go1.18-cf1ec17360 Tue Dec 7 21:54:30 2021 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/hakim/projects/editor/tools/gopls/go.mod"
GOWORK="/Users/hakim/projects/editor/tools/go.work"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bw/6r6k9d113sv1_vvzk_1kfxbm001py5/T/go-build3585926037=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Trying to remove replace in golang.org/x/tools/gopls/go.mod (https://go-review.googlesource.com/c/tools/+/369959).

The following go.work file is in x/tools repo root.

% cat `gotip env GOWORK`
go 1.18

use (
        ./.
        ./gopls
)

What did you expect to see?

Before reading the design proposal:

gotip install succeeds, or
if it's build error, both go install and go build fails.

After reading the design proposal:

I wish I could use go install as before.
But until we figure out how to support this workflow, improve the error message (i.e. maybe a warning if go.work exists AND install fails due to module issue...? ).

What did you see instead?

% cd gopls

% gotip build -x
WORK=/var/folders/bw/6r6k9d113sv1_vvzk_1kfxbm001py5/T/go-build3315844583
cd /Users/hakim/projects/editor/tools
git status --porcelain
cd /Users/hakim/projects/editor/tools
git show -s --format=%H:%ct

% gotip install -x
missing go.sum entry needed to verify package golang.org/x/tools/gopls is provided by exactly one module; to add:
        go mod download golang.org/x/tools

I don't understand how gopls go.mod/go.sum remained in this incomplete state, but decided to follow the instruction.

% gotip mod download golang.org/x/tools
go: skipping download of golang.org/x/tools that resolves to the main module

Instead, users can try

% gotip mod download -workfile=off golang.org/x/tools

cc @matloob @golang/tools-team

@toothrot toothrot added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 8, 2021
@toothrot toothrot added this to the Backlog milestone Dec 8, 2021
@bcmills bcmills modified the milestones: Backlog, Go1.18 Dec 10, 2021
@bcmills
Copy link
Contributor

bcmills commented Dec 10, 2021

Maybe install is failing to engage workspace mode? We certainly shouldn't need a checksum for golang.org/x/tools because it is one of the main modules in the workspace.

@bcmills bcmills added okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1 release-blocker labels Dec 10, 2021
@cherrymui cherrymui removed the okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1 label Dec 14, 2021
@bcmills
Copy link
Contributor

bcmills commented Jan 6, 2022

I think the problem here is that we're trying to verify the checksum of x/tools, which is one of the modules in the workspace (and thus has no checksum, because it may be arbitrarily modified — that's the point of workspaces 😅)!

@matloob matloob self-assigned this Jan 6, 2022
@gopherbot
Copy link

Change https://golang.org/cl/377334 mentions this issue: cmd/go: run go install in workspace mode

jproberts pushed a commit to jproberts/go that referenced this issue Jun 21, 2022
It's too confusing to users to run go install in module mode, so run
it in workspace mode instead.

Fixes golang#50036

Change-Id: Ia99927bd98f54be4c42224a247543892045e3464
Reviewed-on: https://go-review.googlesource.com/c/go/+/377334
Reviewed-by: Bryan Mills <bcmills@google.com>
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
@rsc rsc unassigned matloob Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 2023
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. release-blocker
Projects
None yet
Development

No branches or pull requests

6 participants