]> Cypherpunks repositories - gostls13.git/commit
cmd/go: prevent go work use panic when given a file
authorJohn Anthony <johnanthony.contrib@gmail.com>
Thu, 17 Mar 2022 15:36:52 +0000 (15:36 +0000)
committerBryan Mills <bcmills@google.com>
Thu, 31 Mar 2022 21:10:26 +0000 (21:10 +0000)
commita84ef500213ef6c2a0e4bfd82253e9fcd28f1f62
tree25e4a5b69aa8328cfef1d04c131cb5efb7157094
parent31ee4bb28dff98f29654e7f1b43488641b3157db
cmd/go: prevent go work use panic when given a file

The current implementation fails to identify that an argument to go work
use is a file when expecting a directory, and panics when attempting to
access it as a directory. This change checks arguments are directories
and generates an error otherwise.

Fixes #51749

Change-Id: If8f69d233409e93fcf391a8774bace74c031c986
Reviewed-on: https://go-review.googlesource.com/c/go/+/393615
Reviewed-by: Bryan Mills <bcmills@google.com>
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
src/cmd/go/internal/workcmd/use.go
src/cmd/go/testdata/script/work_use_file.txt [new file with mode: 0644]