@@ -116,7 +116,8 @@ func Run(ctx context.Context, opts options.Options) error {
116
116
newColor (color .FgCyan ).Sprintf (cloneOpts .Path ),
117
117
)
118
118
119
- w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNumber , line ) })
119
+ stageNum := stageNumber
120
+ w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNum , line ) })
120
121
defer w .Close ()
121
122
cloneOpts .Progress = w
122
123
@@ -132,6 +133,8 @@ func Run(ctx context.Context, opts options.Options) error {
132
133
opts .Logger (log .LevelError , "Falling back to the default image..." )
133
134
}
134
135
136
+ _ = w .Close ()
137
+
135
138
// Always clone the repo in remote repo build mode into a location that
136
139
// we control that isn't affected by the users changes.
137
140
if opts .RemoteRepoBuildMode {
@@ -146,7 +149,8 @@ func Run(ctx context.Context, opts options.Options) error {
146
149
newColor (color .FgCyan ).Sprintf (cloneOpts .Path ),
147
150
)
148
151
149
- w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNumber , line ) })
152
+ stageNum := stageNumber
153
+ w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNum , line ) })
150
154
defer w .Close ()
151
155
cloneOpts .Progress = w
152
156
@@ -158,6 +162,8 @@ func Run(ctx context.Context, opts options.Options) error {
158
162
opts .Logger (log .LevelError , "Failed to clone repository for remote repo mode: %s" , fallbackErr .Error ())
159
163
opts .Logger (log .LevelError , "Falling back to the default image..." )
160
164
}
165
+
166
+ _ = w .Close ()
161
167
}
162
168
}
163
169
@@ -893,7 +899,8 @@ func RunCacheProbe(ctx context.Context, opts options.Options) (v1.Image, error)
893
899
newColor (color .FgCyan ).Sprintf (cloneOpts .Path ),
894
900
)
895
901
896
- w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNumber , line ) })
902
+ stageNum := stageNumber
903
+ w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNum , line ) })
897
904
defer w .Close ()
898
905
cloneOpts .Progress = w
899
906
@@ -908,6 +915,8 @@ func RunCacheProbe(ctx context.Context, opts options.Options) (v1.Image, error)
908
915
opts .Logger (log .LevelError , "Failed to clone repository: %s" , fallbackErr .Error ())
909
916
opts .Logger (log .LevelError , "Falling back to the default image..." )
910
917
}
918
+
919
+ _ = w .Close ()
911
920
} else {
912
921
cloneOpts , err := git .CloneOptionsFromOptions (opts )
913
922
if err != nil {
@@ -920,7 +929,8 @@ func RunCacheProbe(ctx context.Context, opts options.Options) (v1.Image, error)
920
929
newColor (color .FgCyan ).Sprintf (cloneOpts .Path ),
921
930
)
922
931
923
- w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNumber , line ) })
932
+ stageNum := stageNumber
933
+ w := git .ProgressWriter (func (line string ) { opts .Logger (log .LevelInfo , "#%d: %s" , stageNum , line ) })
924
934
defer w .Close ()
925
935
cloneOpts .Progress = w
926
936
@@ -932,6 +942,8 @@ func RunCacheProbe(ctx context.Context, opts options.Options) (v1.Image, error)
932
942
opts .Logger (log .LevelError , "Failed to clone repository for remote repo mode: %s" , fallbackErr .Error ())
933
943
opts .Logger (log .LevelError , "Falling back to the default image..." )
934
944
}
945
+
946
+ _ = w .Close ()
935
947
}
936
948
}
937
949
0 commit comments