]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: improve the creation and editing of go.work files
authorMichael Matloob <matloob@golang.org>
Fri, 3 Sep 2021 17:33:37 +0000 (13:33 -0400)
committerMichael Matloob <matloob@golang.org>
Wed, 8 Sep 2021 18:47:32 +0000 (18:47 +0000)
commit37c9552e065fb4331d8cba84c12392806f1ecbbe
tree9c97ca10b43a50eeecf33866389818263c72c1ac
parentc8d4fe2adc556317f75c2ebad195568ad5ff9644
cmd/go: improve the creation and editing of go.work files

This change changes go.work files so that directory paths are clearly
distinguished from module paths by either being rooted absolute paths or
starting with '.' or '..' path elements if they are relative paths.
go mod initwork now checks that the go.work file doesn't already exist
before creating it, and gomod initwork and gomod editwork look up the
module path corresponding to a directory and write it to the directory
directive's comment.

For #45713

Change-Id: I6983779059b7de6fc83d359280ceffb263f6b641
Reviewed-on: https://go-review.googlesource.com/c/go/+/347591
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/modcmd/editwork.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/modload/modfile.go
src/cmd/go/testdata/script/work.txt
src/cmd/go/testdata/script/work_edit.txt