mirror of https://github.com/golang/go.git
internal/gocommand: remove support for -workfile
Remove support for passing the -workfile flag now that the go command no longer supports it. Updates #51215 Change-Id: I95d73fb1a3a6d9bcfaaae5e22e44722118d12c03 Reviewed-on: https://go-review.googlesource.com/c/tools/+/386536 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
e6a7e13388
commit
897bd77cd7
|
|
@ -139,9 +139,6 @@ type Invocation struct {
|
|||
// If ModFile is set, the go command is invoked with -modfile=ModFile.
|
||||
ModFile string
|
||||
|
||||
// If WorkFile is set, the go command is invoked with -workfile=WorkFile.
|
||||
WorkFile string
|
||||
|
||||
// If Overlay is set, the go command is invoked with -overlay=Overlay.
|
||||
Overlay string
|
||||
|
||||
|
|
@ -170,9 +167,6 @@ func (i *Invocation) runWithFriendlyError(ctx context.Context, stdout, stderr io
|
|||
}
|
||||
|
||||
func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error {
|
||||
if i.ModFile != "" && i.WorkFile != "" {
|
||||
return fmt.Errorf("bug: go command invoked with both -modfile and -workfile")
|
||||
}
|
||||
log := i.Logf
|
||||
if log == nil {
|
||||
log = func(string, ...interface{}) {}
|
||||
|
|
@ -185,11 +179,6 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error {
|
|||
goArgs = append(goArgs, "-modfile="+i.ModFile)
|
||||
}
|
||||
}
|
||||
appendWorkFile := func() {
|
||||
if i.WorkFile != "" {
|
||||
goArgs = append(goArgs, "-workfile="+i.WorkFile)
|
||||
}
|
||||
}
|
||||
appendModFlag := func() {
|
||||
if i.ModFlag != "" {
|
||||
goArgs = append(goArgs, "-mod="+i.ModFlag)
|
||||
|
|
@ -208,19 +197,16 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error {
|
|||
// mod needs the sub-verb before flags.
|
||||
goArgs = append(goArgs, i.Args[0])
|
||||
appendModFile()
|
||||
appendWorkFile()
|
||||
goArgs = append(goArgs, i.Args[1:]...)
|
||||
case "get":
|
||||
goArgs = append(goArgs, i.BuildFlags...)
|
||||
appendModFile()
|
||||
appendWorkFile()
|
||||
goArgs = append(goArgs, i.Args...)
|
||||
|
||||
default: // notably list and build.
|
||||
goArgs = append(goArgs, i.BuildFlags...)
|
||||
appendModFile()
|
||||
appendModFlag()
|
||||
appendWorkFile()
|
||||
appendOverlayFlag()
|
||||
goArgs = append(goArgs, i.Args...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -425,18 +425,7 @@ func (s *snapshot) goCommandInvocation(ctx context.Context, flags source.Invocat
|
|||
// 3. We're using at least Go 1.18.
|
||||
useWorkFile := !needTempMod && s.workspace.moduleSource == goWorkWorkspace && s.view.goversion >= 18
|
||||
if useWorkFile {
|
||||
workURI := uriForSource(s.workspace.root, goWorkWorkspace)
|
||||
workFH, err := s.GetFile(ctx, workURI)
|
||||
if err != nil {
|
||||
return "", nil, cleanup, err
|
||||
}
|
||||
// TODO(rfindley): we should use the last workfile that actually parsed, as
|
||||
// tracked by the workspace.
|
||||
tmpURI, cleanup, err = tempWorkFile(workFH)
|
||||
if err != nil {
|
||||
return "", nil, cleanup, err
|
||||
}
|
||||
inv.WorkFile = tmpURI.Filename()
|
||||
// TODO(#51215): build a temp workfile and set GOWORK in the environment.
|
||||
} else if useTempMod {
|
||||
if modURI == "" {
|
||||
return "", nil, cleanup, fmt.Errorf("no go.mod file found in %s", inv.WorkingDir)
|
||||
|
|
|
|||
Loading…
Reference in New Issue