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) {
168168 beforeGoSumFileInfo , beforeGoSumErr := os .Stat (goSumPath )
169169
170170 // run `go mod tidy -e`
171- cmd := toolchain . TidyModule ( goModDir )
171+ cmd := goMod . Tidy ( )
172172 res := util .RunCmd (cmd )
173173
174174 if ! res {
@@ -428,7 +428,7 @@ func installDependencies(workspace project.GoWorkspace) {
428428 path := filepath .Dir (module .Path )
429429
430430 if util .DirExists (filepath .Join (path , "vendor" )) {
431- vendor := toolchain . VendorModule ( path )
431+ vendor := module . Vendor ( )
432432 log .Printf ("Synchronizing vendor file using `go mod vendor` in %s.\n " , path )
433433 util .RunCmd (vendor )
434434 }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package project
33import (
44 "log"
55 "os"
6+ "os/exec"
67 "path/filepath"
78 "regexp"
89 "slices"
@@ -48,6 +49,16 @@ func (module *GoModule) RequiredGoVersion() util.SemVer {
4849 }
4950}
5051
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+
5162// Represents information about a Go project workspace: this may either be a folder containing
5263// a `go.work` file or a collection of `go.mod` files.
5364type GoWorkspace struct {
You can’t perform that action at this time.
0 commit comments