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: go mod tidy ignores the go.work file #51106

Closed
perillo opened this issue Feb 9, 2022 · 1 comment
Closed

cmd/go: go mod tidy ignores the go.work file #51106

perillo opened this issue Feb 9, 2022 · 1 comment

Comments

@perillo
Copy link
Contributor

perillo commented Feb 9, 2022

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

$ go version
go version go1.18beta2 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="/home/manlio/.local/bin"
GOCACHE="/home/manlio/.cache/go-build"
GOENV="/home/manlio/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE="*.local"
GOMODCACHE="/home/manlio/.local/lib/go/pkg/mod"
GONOPROXY=""
GONOSUMDB="*.local"
GOOS="linux"
GOPATH="/home/manlio/.local/lib/go:/home/manlio/src/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/manlio/sdk/go1.18beta2"
GOSUMDB="sum.golang.org"
GOTMPDIR="/tmp/gotmp"
GOTOOLDIR="/home/manlio/sdk/go1.18beta2/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18beta2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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/gotmp/go-build2069986986=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.18beta2 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.18beta2
uname -sr: Linux 5.16.3-arch1-1
/usr/lib/libc.so.6: GNU C Library (GNU libc) release release version 2.33.
gdb --version: GNU gdb (GDB) 11.2

What did you do?

I have the following directory structure:

test.localhost/workspace/
    go.work
    main/
        go.mod
        main.go
    deps/
        go.mod
        deps.go

go.work:

go 1.18

use (
	deps
	main
)

main/go.mod:

module test.localhost/workspace/main

go 1.18

main/main.go:

package main

import (
	"fmt"

	"test.localhost/workspace/deps"
)

func main() {
	fmt.Println(deps.Do())
}

deps/go.mod:

module test.localhost/workspace/deps

go 1.18

deps/deps.go:

package deps

func Do() int {
	return 777
}

I ran, from the main directory, the command go mod tidy.

What did you expect to see?

Nothing.

What did you see instead?

The command ignored the go.work file and tried to fetch the test.localhost/workspace/deps module, failing with the error:

go: finding module for package test.localhost/workspace/deps
test.localhost/workspace/main imports
	test.localhost/workspace/deps: cannot find module providing package test.localhost/workspace/deps: unrecognized import path "test.localhost/workspace/deps": https fetch: Get "https://test.localhost/workspace/deps?go-get=1": dial tcp [::1]:443: connect: connection refused
@seankhliao
Copy link
Member

Duplicate of #50750

@seankhliao seankhliao marked this as a duplicate of #50750 Feb 9, 2022
trajan0x added a commit to synapsecns/sanguine that referenced this issue Feb 3, 2023
@golang golang locked and limited conversation to collaborators Feb 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants