Skip to content

cmd/go: mod vendor tries to evaluate go:embed pattern inside _test.go files #63473

Closed
@wizardishungry

Description

@wizardishungry

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

$ go version
go version go1.21.1 darwin/arm64

Does this issue reproduce with the latest release?

I don't know.

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

go env Output
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/jon/Library/Caches/go-build'
GOENV='/Users/jon/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/jon/.asdf/installs/golang/1.21.1/packages/pkg/mod'
GONOPROXY='bitbucket.org/thetalake'
GONOSUMDB='bitbucket.org/thetalake'
GOOS='darwin'
GOPATH='/Users/jon/.asdf/installs/golang/1.21.1/packages'
GOPRIVATE='bitbucket.org/thetalake'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/jon/.asdf/installs/golang/1.21.1/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/jon/.asdf/installs/golang/1.21.1/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.1'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/jon/go.mod'
GOWORK=''
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/4y/nhc3l04n53x2125plghk78bw0000gp/T/go-build3701474416=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

  1. Import a package containing go:embed directives inside a _test.go file.
import _ "github.com/emiago/sipgo"

For example, https://github.com/emiago/sipgo/blob/main/server_integration_test.go#L26 contains go:embed directives that will not satisfied.

  1. Run go mod vendor:

What did you expect to see?

go mod vendor completes normally

What did you see instead?

go: pattern testdata/certs/client.crt: no matching files found

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeGoCommandcmd/goNeedsFixThe 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