Skip to content

Commit f4dce0b

Browse files
findleyrgopherbot
authored andcommitted
Revert "x/playground: remove -mod=mod and execute go mod tidy before command"
This reverts CL 458895. Reason for revert: Broke the playground with "no space left on device". Change-Id: I0ae0a8489446bd66b49196dce64ee79de6f85486 Reviewed-on: https://go-review.googlesource.com/c/playground/+/560460 Commit-Queue: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Auto-Submit: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
1 parent 731d161 commit f4dce0b

File tree

4 files changed

+2
-79
lines changed

4 files changed

+2
-79
lines changed

mod.go

-36
This file was deleted.

sandbox.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ func sandboxBuild(ctx context.Context, tmpDir string, in []byte, vet bool) (br *
460460
// Create a GOPATH just for modules to be downloaded
461461
// into GOPATH/pkg/mod.
462462
cmd.Args = append(cmd.Args, "-modcacherw")
463+
cmd.Args = append(cmd.Args, "-mod=mod")
463464
br.goPath, err = os.MkdirTemp("", "gopath")
464465
if err != nil {
465466
log.Printf("error creating temp directory: %v", err)
@@ -471,12 +472,6 @@ func sandboxBuild(ctx context.Context, tmpDir string, in []byte, vet bool) (br *
471472
out := &bytes.Buffer{}
472473
cmd.Stderr, cmd.Stdout = out, out
473474

474-
// Run "go mod tidy" before executing a command.
475-
_, err = modTidy(ctx, tmpDir, br.goPath)
476-
if err != nil {
477-
return nil, fmt.Errorf("error running go mod tidy: %v", err)
478-
}
479-
480475
if err := cmd.Start(); err != nil {
481476
return nil, fmt.Errorf("error starting go build: %v", err)
482477
}

tests.go

-36
Original file line numberDiff line numberDiff line change
@@ -633,40 +633,4 @@ func print() {
633633
`, errors: `./foo.go:6:2: syntax error: unexpected =, expecting }
634634
`,
635635
},
636-
{
637-
name: "workspace",
638-
prog: `
639-
package main
640-
641-
import "internal/bar"
642-
643-
func main() {
644-
bar.Print()
645-
}
646-
-- go.work --
647-
go 1.18
648-
649-
use (
650-
.
651-
./projects/bar
652-
)
653-
-- go.mod --
654-
module internal/foo
655-
656-
go 1.18
657-
658-
require internal/bar v0.0.0
659-
-- projects/bar/go.mod --
660-
module internal/bar
661-
662-
go 1.18
663-
-- projects/bar/upper.go --
664-
package bar
665-
666-
import "fmt"
667-
668-
func Print() {
669-
fmt.Println("bar")
670-
}
671-
`, want: "bar\n"},
672636
}

vet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func vetCheckInDir(ctx context.Context, dir, goPath string) (output string, exec
6262
mGoVetLatency.M(float64(time.Since(start))/float64(time.Millisecond)))
6363
}()
6464

65-
cmd := exec.Command("go", "vet", "--tags=faketime")
65+
cmd := exec.Command("go", "vet", "--tags=faketime", "--mod=mod")
6666
cmd.Dir = dir
6767
// Linux go binary is not built with CGO_ENABLED=0.
6868
// Prevent vet to compile packages in cgo mode.

0 commit comments

Comments
 (0)