@@ -113,22 +113,30 @@ func main() {
113113 }
114114 // Use a fake module that doesn't start with cloud.google.com/go.
115115 runCmd (workingDir , "go" , "mod" , "init" , "cloud.google.com/lets-build-some-docs" )
116+
117+ failed := false
116118 for _ , m := range mods {
117119 log .Printf ("Processing %s@%s" , m .Path , m .Version )
118120
119121 // Always output to specific directory.
120122 path := filepath .Join (* outDir , fmt .Sprintf ("%s@%s" , m .Path , m .Version ))
121123 if err := process (m , workingDir , path , * print ); err != nil {
122124 log .Printf ("Failed to process %v: %v" , m , err )
125+ failed = true
123126 }
124127 log .Printf ("Done with %s@%s" , m .Path , m .Version )
125128 }
129+ if failed {
130+ os .Exit (1 )
131+ }
126132}
127133
128134func runCmd (dir , name string , args ... string ) error {
129135 log .Printf ("> [%s] %s %s" , dir , name , strings .Join (args , " " ))
130136 cmd := exec .Command (name , args ... )
131137 cmd .Dir = dir
138+ cmd .Stdout = os .Stdout
139+ cmd .Stderr = os .Stderr
132140 if err := cmd .Start (); err != nil {
133141 return fmt .Errorf ("Start: %v" , err )
134142 }
@@ -143,7 +151,8 @@ func process(mod indexEntry, workingDir, outDir string, print bool) error {
143151 if err := runCmd (workingDir , "go" , "mod" , "tidy" ); err != nil {
144152 return fmt .Errorf ("go mod tidy error: %v" , err )
145153 }
146- if err := runCmd (workingDir , "go" , "get" , "-d" , "-t" , mod .Path + "/...@" + mod .Version ); err != nil {
154+ // Don't do /... because it fails on submodules.
155+ if err := runCmd (workingDir , "go" , "get" , "-d" , "-t" , mod .Path + "@" + mod .Version ); err != nil {
147156 return fmt .Errorf ("go get %s@%s: %v" , mod .Path , mod .Version , err )
148157 }
149158
0 commit comments