Skip to content

x/vgo: vgo mod -require flag value format conflicts with shell redirect #26230

Closed
@myitcv

Description

@myitcv

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.3 linux/amd64
vgo commit 6cd5a417451d8ee907692eded07ef1b6b53825b1

Does this issue reproduce with the latest release?

Yes.

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/tmp/tmp.sBFmjarlrd"
GOPROXY=""
GORACE=""
GOROOT="/home/myitcv/gos"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build515814233=/tmp/go-build -gno-record-gcc-switches"
VGOMODROOT="/tmp/tmp.sBFmjarlrd/hello"

What did you do?

cd `mktemp -d`
export GOPATH=$PWD
mkdir hello
cd hello
vgo mod -init -module example.com/hello
vgo mod -require rsc.io/quote@v1.5.2
vgo mod -replace rsc.io/quote@v1.5.2=>github.com/myitcv/vgo-by-example-quote-fork@master

gives:

bash: github.com/myitcv/vgo-by-example-quote-fork@master: No such file or directory

What did you expect to see?

Because the value passed to the -require flag is not quoted, this output is expected (at least in Bash).

So I wonder whether we should either:

  • do nothing, on the basis vgo mod will mostly be called by tools (assuming it will)
  • change the format of the value passed to the -require flag
  • quote the example:
...

The -replace='old@v=>new@w' and -dropreplace=old@v flags
add and drop a replacement of the given module path and version pair.
Note that -replace overrides any existing replacements for old@v.

...

because it feels like this is something that people will unwittingly fall foul of.

/cc @rsc @bcmills

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions