Skip to content

cmd/go: work use silently ignores nonexistent target #51965

@ansidev

Description

@ansidev

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

go version go1.18 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=""
GOARCH="amd64"
GOBIN=""
GOCACHE="{secret}"
GOENV="{secret}"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="{secret}"
GONOPROXY="{secret}"
GONOSUMDB="{secret}"
GOOS="darwin"
GOPATH="/Users/mac/go"
GOPRIVATE="{secret}"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.18/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.18/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK="{secret}"
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/rg/2ghbpv594593xwc66z446w5w0000gn/T/go-build2275001121=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Run the following commands:

(Format: $ {current_dir} > {command})
$ go > mkdir workspace
$ go > cd workspace
$ workspace > go work init
$ workspace > ls -la
total 8
-rw-r--r-- 1 user staff 8B Mar 26 17:51 go.work
$ workspace > go work use ./lib

What did you expect to see?

Error, because the folder ./lib does not exist.

What did you see instead?

Empty output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions