Skip to content

go 1.22.6 workspace cannot upgrade modules anymore using go get -u ./... getting error: package foo/bark is not in std (/usr/local/go/src/foo/bark) #68784

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

Closed
khanakia opened this issue Aug 8, 2024 · 4 comments

Comments

@khanakia
Copy link

khanakia commented Aug 8, 2024

Go version

go version go1.22.6 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Volumes/D/khanakia/Library/Caches/go-build'
GOENV='/Volumes/D/khanakia/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Volumes/D/khanakia/go/pkg/mod'
GONOPROXY='github.com/theuxm'
GONOSUMDB='github.com/theuxm'
GOOS='darwin'
GOPATH='/Volumes/D/khanakia/go'
GOPRIVATE='github.com/theuxm'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.6'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK='/Volumes/D/khanakia/Downloads/workspace/go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sk/k6vkn27d2xbcxcj1ll6dvwjw0000gn/T/go-build3767486900=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

I am using Golang workspaces and when try to upgrade the modules inside the workspace it does not work
Before it was working in older versions of golang

  1. Clone this repo https://github.com/khanakia/goworkspace1
  2. Run below command
cd hello
go get -u ./...

What did you see happen?

➜  hello go get -u ./...
go: hello imports
	foo/bark: package foo/bark is not in std (/usr/local/go/src/foo/bark)

What did you expect to see?

It should upgrade the module

require github.com/spf13/cobra v1.8.0
to
require github.com/spf13/cobra v1.8.1
@seankhliao
Copy link
Member

This has not worked since at least go1.16 (I didn't check further back).
I think this is expected behavior when you don't have a require for the other module, go get inherently queries for a remote source.

Closing as working as intended

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2024
@RassulYunussov
Copy link

Hi @seankhliao
But how are we supposed to update dependencies then for a sub module of a workspace?

@RassulYunussov
Copy link

RassulYunussov commented Mar 26, 2025

replace instruction in mod file helps

example:
replace shared => ../shared

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants