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 vendor: malfored file path: invalid char '|'" #27642

Closed
moul opened this issue Sep 12, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@moul
Copy link

commented Sep 12, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/moul/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/moul/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/moul/go/src/github.com/moul/test2-go-mod-malformed-path/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 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/v_/8mtm991n3wn4f688btpc0mbw0000gn/T/go-build185240075=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  1. create a repo with valid go files + non-go files containing | chars in filenames: https://github.com/moul/test-go-mod-malformed-path
  2. create another repo that depends on the first one: https://github.com/moul/test2-go-mod-malformed-path
  3. without go mod, you can go build
  4. with go mod:
    $ go mod vendor
    go: finding github.com/moul/test-go-mod-malformed-path latest
    go: extracting github.com/moul/test-go-mod-malformed-path v0.0.0-20180912153824-5c1104fa0b94
    -> unzip /Users/moul/go/pkg/mod/cache/download/github.com/moul/test-go-mod-malformed-path/@v/v0.0.0-20180912153824-5c1104fa0b94.zip: malformed file path "non-go-file-with-pipe|char.txt": invalid char '|'
    go: no dependencies to vendor

What did you expect to see?

go mod vendor should success

What did you see instead?

go mod vendor failing with the above message

@myitcv

This comment has been minimized.

Copy link
Member

commented Sep 12, 2018

Possibly related to #26672

@myitcv myitcv added the modules label Sep 12, 2018

@myitcv

This comment has been minimized.

Copy link
Member

commented Sep 12, 2018

@bcmills

This comment has been minimized.

Copy link
Member

commented Sep 12, 2018

The module zip format is intended to be portable across filesystems. The pipe character is reserved on Windows, so it cannot appear within a module either. (We may eventually relax that requirement — for example, by escaping disallowed characters — but for now it is what it is.)

It is usually possible to avoid the problem by placing another (possibly-empty) go.mod file within the directory containing the disallowed file, thus excluding it from the parent module (and from that module's zip file).

As far as I can tell, this is working as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.