That is replaced by `go work edit`.
Change-Id: I39996c7bea0182a18edf6a1f70b6616c74099a1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/370139
Reviewed-by: Michael Matloob <matloob@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
//
// 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.
// 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.
//
// 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
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
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.
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.
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 {
}
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 {
// 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
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
# overriding it in the go.work file.
! go list -m example.com/dep
-stderr 'go: conflicting replacements for example.com/dep@v1.0.0:\n\t./dep1\n\t./dep2\nuse "go mod editwork -replace example.com/dep@v1.0.0=\[override\]" to resolve'
+stderr 'go: conflicting replacements for example.com/dep@v1.0.0:\n\t./dep1\n\t./dep2\nuse "go work edit -replace example.com/dep@v1.0.0=\[override\]" to resolve'
go work edit -replace example.com/dep@v1.0.0=./dep1
go list -m example.com/dep
stdout 'example.com/dep v1.0.0 => ./dep1'