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/internal/moddeps: test fails to find std module when the last element of GOROOT begins with a dot or underscore #54221

Closed
p-kraszewski opened this issue Aug 3, 2022 · 8 comments
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. help wanted NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@p-kraszewski
Copy link

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

$ go version
go version go1.18.4 freebsd/amd64

Does this issue reproduce with the latest release?

Yes, on 2 different operating systems

  • FreeBSD 13.1 with Go 1.18.4 from packages
  • Arch Linux with Go 1.19 from packages - the error messages are exactly the same, didn't copy output twice.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="freebsd"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go118"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go118/pkg/tool/freebsd_amd64"
GOVCS=""
GOVERSION="go1.18.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="cc"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3287959224=/tmp/go-build -gno-record-gcc-switches"

What did you do?

> git describe --tags --long --all
tags/go1.19-0-g43456202a1

> ./all.bash

What did you expect to see?

Building Go cmd/dist using /usr/local/go118. (go1.18.4 freebsd/amd64)
Building Go toolchain1 using /usr/local/go118.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for freebsd/amd64.

##### Test execution environment.
# GOARCH: amd64
# CPU: Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz
# GOOS: freebsd
# OS Version: FreeBSD 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 MAXPHYS  amd64

##### Testing packages.
ok      archive/tar     0.461s
ok      archive/zip     0.596s
ok      bufio   0.331s
ok      bytes   0.284s
ok      compress/bzip2  0.764s
[...]
All tests successful

What did you see instead?

Building Go cmd/dist using /usr/local/go118. (go1.18.4 freebsd/amd64)
Building Go toolchain1 using /usr/local/go118.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for freebsd/amd64.

##### Test execution environment.
# GOARCH: amd64
# CPU: Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz
# GOOS: freebsd
# OS Version: FreeBSD 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 MAXPHYS  amd64

##### Testing packages.
ok      archive/tar     0.461s
ok      archive/zip     0.596s
ok      bufio   0.331s
ok      bytes   0.284s
ok      compress/bzip2  0.764s

[...]

ok      cmd/internal/goobj      0.045s
--- FAIL: TestAllDependencies (0.00s)
moddeps_test.go:49: findGorootModules didn't find the well-known module "std"
--- FAIL: TestDependencyVersionsConsistent (0.00s)
moddeps_test.go:350: findGorootModules didn't find the well-known module "std"
FAIL
FAIL    cmd/internal/moddeps    0.061s
ok      cmd/internal/notsha256  0.177s

[...]

ok      cmd/vet 7.485s
FAIL
go tool dist: Failed: exit status 1
@seankhliao
Copy link
Member

please try this with the upstream source tree.

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 3, 2022
@p-kraszewski
Copy link
Author

p-kraszewski commented Aug 3, 2022

If by a upstream source tree you mean one from the official manual:

git clone https://go.googlesource.com/go goroot
cd goroot
git checkout release-branch.go1.19

# This today still equals to tag go1.19

then my source code was exactly that.

> git log

commit 43456202a1e55da55666fac9d56ace7654a65b64 (HEAD -> release-branch.go1.19, tag: go1.19, origin/release-branch.go1.19)
Author: Gopher Robot <gobot@golang.org>
Date:   Tue Aug 2 16:39:14 2022 +0000

[release-branch.go1.19] go1.19

Change-Id: Iea643b04a7eea7c882d7eec481b67e4ecc08a559
Reviewed-on: https://go-review.googlesource.com/c/go/+/420834
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>

On a fresh account (so only a system Go is visible for bootstrap) with abovementioned source checkout still gets the two errors.

@dmgk
Copy link
Member

dmgk commented Aug 3, 2022

I cannot reproduce this on 14.0-CURRENT. Is there anything special in the environment?

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 3, 2022
@p-kraszewski
Copy link
Author

p-kraszewski commented Aug 4, 2022

Nothing special.

  • OS: FreeBSD MaxBSD-1 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 MAXPHYS amd64 (That MAXPHYS is just two-line config tweak bumping up maximal DMA transfer size.)
  • x86_64 machine (2x 12C/24T CPU, 256GB RAM)
  • System GO (1st phase bootstrap): go version go1.18.4 freebsd/amd64 installed by pkg install go
  • No GO environment variables set (GOROOT, GOPATH, etc)
  • Shell: ZSH with starship, but the error is reproducible from vanilla csh.
  • No fancy environment settings (csh has unaltered after-the-install vanilla settings).

Nothing unusual and exactly reproducible on Arch machine (other OS, other bootstrap version, other hardware).

The only thing in common is that neither of machines is compiling go from ${HOME}/go - but the example in the manual is neither. My regular compilations run from ${HOME}/.go and experiments on a clean account were from ${HOME}/.goroot.

@p-kraszewski
Copy link
Author

Got it!

The cmd/internal/moddeps test fails, when the directory with go source is hidden!

@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 4, 2022
@seankhliao seankhliao changed the title ./all.bash for 1.19.0 fails some tests cmd/go: GOROOT in hidden directory, didn't find the well-known module "std" Aug 5, 2022
@seankhliao
Copy link
Member

cc @bcmills @matloob

@seankhliao seankhliao added this to the Unplanned milestone Aug 20, 2022
@bcmills bcmills changed the title cmd/go: GOROOT in hidden directory, didn't find the well-known module "std" cmd/internal/moddeps: test fails to find std module when the last element of GOROOT begins with a dot or underscore Jan 4, 2024
@bcmills bcmills added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsFix The path to resolution is known, but the work has not been done. labels Jan 4, 2024
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 4, 2024
@bcmills
Copy link
Contributor

bcmills commented Jan 4, 2024

Should be an easy fix: in the call to filepath.WalkDir in the test, we should not return filepath.SkipDir for the root path itself.

Just need to wrap this block with if path != root { … }, I think:
https://cs.opensource.google/go/go/+/master:src/cmd/internal/moddeps/moddeps_test.go;l=457-473;drc=1908d4354b5b1cb02edd9f93d024551fe812eb22

@bcmills bcmills modified the milestones: Unplanned, Backlog Jan 4, 2024
qiulaidongfeng added a commit to qiulaidongfeng/go that referenced this issue Jan 26, 2024
…tart with a dot or underscore

Fixes golang#54221

Change-Id: I8b1e0784390530440e7063c9608c7f4e0fe31a82
@gopherbot
Copy link

Change https://go.dev/cl/558696 mentions this issue: cmd/internal/moddeps: fix test fail when the last element of GOROOT start with a dot or underscore

qiulaidongfeng added a commit to qiulaidongfeng/go that referenced this issue Jan 26, 2024
…tart with a dot or underscore

Fixes golang#54221

Change-Id: I8b1e0784390530440e7063c9608c7f4e0fe31a82
@dmitshur dmitshur modified the milestones: Backlog, Go1.23 Jan 26, 2024
@dmitshur dmitshur added the FixPending Issues that have a fix which has not yet been reviewed or submitted. label Jan 26, 2024
ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
…tart with a dot or underscore

Fixes golang#54221

Change-Id: Id16f553251daf0b7c51f45232a4133f7dfb1ebb9
GitHub-Last-Rev: 675c2bf
GitHub-Pull-Request: golang#65298
Reviewed-on: https://go-review.googlesource.com/c/go/+/558696
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. help wanted NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
6 participants