Skip to content

cmd/go: panic when argument doesn't match any packages #28696

@nicksnyder

Description

@nicksnyder

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

$ go version
go version go1.11.2 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
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/nick/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/nick/dev/gopath"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/l6/djg_zw1j5lgbwz4h5q92lnwr0000gn/T/go-build874216167=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ go run notadir/...
go: warning: "notadir/..." matched no packages
panic: runtime error: index out of range

goroutine 1 [running]:
cmd/go/internal/run.runRun(0x195b2e0, 0xc0000a60b0, 0x1, 0x1)
	/usr/local/Cellar/go/1.11.2/libexec/src/cmd/go/internal/run/run.go:88 +0xc01
main.main()
	/usr/local/Cellar/go/1.11.2/libexec/src/cmd/go/main.go:219 +0x7d4

What did you expect to see?

Not a panic.

What did you see instead?

A panic.

Related to #8165 ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions