Skip to content

cmd/go: clean paths before checking whether command line files are in same directory #47392

@Gerrard-YNWA

Description

@Gerrard-YNWA

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

$ go version
go version go1.16.5 darwin/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="/Users/gerrard/Library/Caches/go-build"
GOENV="/Users/gerrard/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/gerrard/workspace/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/gerrard/workspace/go"
GOPRIVATE=""
GOPROXY="https://goproxy.io"
GOROOT="/usr/local/Cellar/go/1.16.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.16.5/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/gerrard/workspace/aispeech/code/pasc-server/go.mod"
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/yy/1gf6d2mn3vv0270568dg6l7c0000gn/T/go-build2904605194=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I typed go test manually to run test in terminal and got the error.

$ go test ./test/e2e/foo_test.go test/e2e/e2e.go
named files must all be in one directory; have ./test/e2e/ and test/e2e/

What did you expect to see?

Treat ./test/e2e/ and test/e2e/ as same dir

What did you see instead?

It seems that the internal load package use the filepath.Split in GoFilesPackage function to the ensure all named files must all be in one directory.

But filepath.Split only does the split and does not normalized the result.

I'm not sure whether we can replace it with filepath.Dir and get rid of the such error prompt?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions