[go] src/cmd/go: fix references to old `go mod editwork`

1 view
Skip to first unread message

Hyang-Ah Hana Kim (Gerrit)

unread,
Dec 7, 2021, 8:23:14 PM12/7/21
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Ian Lance Taylor, Michael Matloob, Gopher Robot, golang-co...@googlegroups.com

Hyang-Ah Hana Kim submitted this change.

View Change



1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Approvals: Michael Matloob: Looks good to me, approved Hyang-Ah Hana Kim: Trusted
cmd/go: fix references to old `go mod editwork`

That is replaced by `go work edit`.

Change-Id: I39996c7bea0182a18edf6a1f70b6616c74099a1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/370139
Reviewed-by: Michael Matloob <mat...@golang.org>
Trust: Hyang-Ah Hana Kim <hya...@gmail.com>
---
M src/cmd/go/internal/workcmd/init.go
M src/cmd/go/internal/workcmd/edit.go
M src/cmd/go/testdata/script/work_replace_conflict.txt
M src/cmd/go/alldocs.go
M src/cmd/go/internal/modload/init.go
5 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index b9fca79..f9a2b59 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -1407,10 +1407,10 @@
//
// go work edit [editing flags] [go.work]
//
-// Editwork provides a command-line interface for editing go.work,
+// Edit provides a command-line interface for editing go.work,
// for use primarily by tools or scripts. It only reads go.work;
// it does not look up information about the modules involved.
-// If no file is specified, editwork looks for a go.work file in the current
+// If no file is specified, Edit looks for a go.work file in the current
// directory and its parent directories
//
// The editing flags specify a sequence of editing operations.
@@ -1418,7 +1418,7 @@
// The -fmt flag reformats the go.work file without making other changes.
// This reformatting is also implied by any other modifications that use or
// rewrite the go.mod file. The only time this flag is needed is if no other
-// flags are specified, as in 'go mod editwork -fmt'.
+// flags are specified, as in 'go work edit -fmt'.
//
// The -use=path and -dropuse=path flags
// add and drop a use directive from the go.work file's set of module directories.
@@ -1478,10 +1478,10 @@
//
// go work init [moddirs]
//
-// go mod initwork initializes and writes a new go.work file in the current
+// Init initializes and writes a new go.work file in the current
// directory, in effect creating a new workspace at the current directory.
//
-// go mod initwork optionally accepts paths to the workspace modules as arguments.
+// go work init optionally accepts paths to the workspace modules as arguments.
// If the argument is omitted, an empty workspace with no modules will be created.
//
// See the workspaces design proposal at
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go
index 943547e..854c17d 100644
--- a/src/cmd/go/internal/modload/init.go
+++ b/src/cmd/go/internal/modload/init.go
@@ -1019,7 +1019,7 @@
if replacedByWorkFile[r.Old.Path] {
continue
} else if prev, ok := replacements[r.Old]; ok && !curModuleReplaces[r.Old] && prev != r.New {
- base.Fatalf("go: conflicting replacements for %v:\n\t%v\n\t%v\nuse \"go mod editwork -replace %v=[override]\" to resolve", r.Old, prev, r.New, r.Old)
+ base.Fatalf("go: conflicting replacements for %v:\n\t%v\n\t%v\nuse \"go work edit -replace %v=[override]\" to resolve", r.Old, prev, r.New, r.Old)
}
curModuleReplaces[r.Old] = true
replacements[r.Old] = r.New
diff --git a/src/cmd/go/internal/workcmd/edit.go b/src/cmd/go/internal/workcmd/edit.go
index 03a27f2b..c420007 100644
--- a/src/cmd/go/internal/workcmd/edit.go
+++ b/src/cmd/go/internal/workcmd/edit.go
@@ -24,10 +24,10 @@
var cmdEdit = &base.Command{
UsageLine: "go work edit [editing flags] [go.work]",
Short: "edit go.work from tools or scripts",
- Long: `Editwork provides a command-line interface for editing go.work,
+ Long: `Edit provides a command-line interface for editing go.work,
for use primarily by tools or scripts. It only reads go.work;
it does not look up information about the modules involved.
-If no file is specified, editwork looks for a go.work file in the current
+If no file is specified, Edit looks for a go.work file in the current
directory and its parent directories

The editing flags specify a sequence of editing operations.
@@ -35,7 +35,7 @@
The -fmt flag reformats the go.work file without making other changes.
This reformatting is also implied by any other modifications that use or
rewrite the go.mod file. The only time this flag is needed is if no other
-flags are specified, as in 'go mod editwork -fmt'.
+flags are specified, as in 'go work edit -fmt'.

The -use=path and -dropuse=path flags
add and drop a use directive from the go.work file's set of module directories.
@@ -123,7 +123,7 @@
len(workedits) > 0

if !anyFlags {
- base.Fatalf("go: no flags specified (see 'go help mod editwork').")
+ base.Fatalf("go: no flags specified (see 'go help work edit').")
}

if *editJSON && *editPrint {
@@ -131,7 +131,7 @@
}

if len(args) > 1 {
- base.Fatalf("go: 'go mod editwork' accepts at most one argument")
+ base.Fatalf("go: 'go help work edit' accepts at most one argument")
}
var gowork string
if len(args) == 1 {
diff --git a/src/cmd/go/internal/workcmd/init.go b/src/cmd/go/internal/workcmd/init.go
index fde1483..2297ac2 100644
--- a/src/cmd/go/internal/workcmd/init.go
+++ b/src/cmd/go/internal/workcmd/init.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

-// go mod initwork
+// go work init

package workcmd

@@ -20,10 +20,10 @@
var cmdInit = &base.Command{
UsageLine: "go work init [moddirs]",
Short: "initialize workspace file",
- Long: `go mod initwork initializes and writes a new go.work file in the current
+ Long: `Init initializes and writes a new go.work file in the current
directory, in effect creating a new workspace at the current directory.

-go mod initwork optionally accepts paths to the workspace modules as arguments.
+go work init optionally accepts paths to the workspace modules as arguments.
If the argument is omitted, an empty workspace with no modules will be created.

See the workspaces design proposal at
diff --git a/src/cmd/go/testdata/script/work_replace_conflict.txt b/src/cmd/go/testdata/script/work_replace_conflict.txt
index e5677b2..81d1fcb 100644
--- a/src/cmd/go/testdata/script/work_replace_conflict.txt
+++ b/src/cmd/go/testdata/script/work_replace_conflict.txt
@@ -2,7 +2,7 @@
# overriding it in the go.work file.

! go list -m example.com/dep
-stderr 'go: conflicting replacements for example.com/d...@v1.0.0:\n\t./dep1\n\t./dep2\nuse "go mod editwork -replace example.com/d...@v1.0.0=\[override\]" to resolve'
+stderr 'go: conflicting replacements for example.com/d...@v1.0.0:\n\t./dep1\n\t./dep2\nuse "go work edit -replace example.com/d...@v1.0.0=\[override\]" to resolve'
go work edit -replace example.com/d...@v1.0.0=./dep1
go list -m example.com/dep
stdout 'example.com/dep v1.0.0 => ./dep1'

To view, visit change 370139. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I39996c7bea0182a18edf6a1f70b6616c74099a1b
Gerrit-Change-Number: 370139
Gerrit-PatchSet: 3
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Ian Lance Taylor <ia...@golang.org>
Gerrit-MessageType: merged
Reply all
Reply to author
Forward
0 new messages