File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ func tryUpdateGoModAndGoSum(workspace project.GoWorkspace) {
168
168
beforeGoSumFileInfo , beforeGoSumErr := os .Stat (goSumPath )
169
169
170
170
// run `go mod tidy -e`
171
- cmd := toolchain . TidyModule ( goModDir )
171
+ cmd := goMod . Tidy ( )
172
172
res := util .RunCmd (cmd )
173
173
174
174
if ! res {
@@ -428,7 +428,7 @@ func installDependencies(workspace project.GoWorkspace) {
428
428
path := filepath .Dir (module .Path )
429
429
430
430
if util .DirExists (filepath .Join (path , "vendor" )) {
431
- vendor := toolchain . VendorModule ( path )
431
+ vendor := module . Vendor ( )
432
432
log .Printf ("Synchronizing vendor file using `go mod vendor` in %s.\n " , path )
433
433
util .RunCmd (vendor )
434
434
}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package project
3
3
import (
4
4
"log"
5
5
"os"
6
+ "os/exec"
6
7
"path/filepath"
7
8
"regexp"
8
9
"slices"
@@ -48,6 +49,16 @@ func (module *GoModule) RequiredGoVersion() util.SemVer {
48
49
}
49
50
}
50
51
52
+ // Runs `go mod tidy` for this module.
53
+ func (module * GoModule ) Tidy () * exec.Cmd {
54
+ return toolchain .TidyModule (filepath .Dir (module .Path ))
55
+ }
56
+
57
+ // Runs `go mod vendor -e` for this module.
58
+ func (module * GoModule ) Vendor () * exec.Cmd {
59
+ return toolchain .VendorModule (filepath .Dir (module .Path ))
60
+ }
61
+
51
62
// Represents information about a Go project workspace: this may either be a folder containing
52
63
// a `go.work` file or a collection of `go.mod` files.
53
64
type GoWorkspace struct {
You can’t perform that action at this time.
0 commit comments