@@ -106,21 +106,21 @@ func (b *Builder) createBuildOptionsJSON() error {
106
106
}
107
107
108
108
func (b * Builder ) wipeBuildPath () error {
109
- wipe := func () error {
110
- // FIXME: this should go outside legacy and behind a `logrus` call so users can
111
- // control when this should be printed.
112
- // logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED + constants.MSG_REBUILD_ALL)
113
- if err := b .buildOptions .buildPath .RemoveAll (); err != nil {
114
- return errors .WithMessage (err , tr ("cleaning build path" ))
115
- }
116
- if err := b .buildOptions .buildPath .MkdirAll (); err != nil {
117
- return errors .WithMessage (err , tr ("cleaning build path" ))
118
- }
119
- return nil
109
+ // FIXME: this should go outside legacy and behind a `logrus` call so users can
110
+ // control when this should be printed.
111
+ // logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED + constants.MSG_REBUILD_ALL)
112
+ if err := b .buildOptions .buildPath .RemoveAll (); err != nil {
113
+ return errors .WithMessage (err , tr ("cleaning build path" ))
120
114
}
115
+ if err := b .buildOptions .buildPath .MkdirAll (); err != nil {
116
+ return errors .WithMessage (err , tr ("cleaning build path" ))
117
+ }
118
+ return nil
119
+ }
121
120
121
+ func (b * Builder ) wipeBuildPathIfBuildOptionsChanged () error {
122
122
if b .buildOptions .clean {
123
- return wipe ()
123
+ return b . wipeBuildPath ()
124
124
}
125
125
126
126
// Load previous build options map
@@ -140,7 +140,7 @@ func (b *Builder) wipeBuildPath() error {
140
140
var prevOpts * properties.Map
141
141
if err := json .Unmarshal (buildOptionsJSONPrevious , & prevOpts ); err != nil || prevOpts == nil {
142
142
b .logger .Info (tr ("%[1]s invalid, rebuilding all" , "build.options.json" ))
143
- return wipe ()
143
+ return b . wipeBuildPath ()
144
144
}
145
145
146
146
// Since we might apply a side effect we clone it
@@ -169,5 +169,5 @@ func (b *Builder) wipeBuildPath() error {
169
169
}
170
170
}
171
171
172
- return wipe ()
172
+ return b . wipeBuildPath ()
173
173
}
0 commit comments