github.com/dnephin/dobi@v0.15.0/tasks/image/remove.go (about) 1 package image 2 3 import ( 4 "github.com/dnephin/dobi/tasks/context" 5 ) 6 7 // RunRemove builds or pulls an image if it is out of date 8 func RunRemove(ctx *context.ExecuteContext, t *Task, _ bool) (bool, error) { 9 removeTag := func(tag string) error { 10 if err := ctx.Client.RemoveImage(tag); err != nil { 11 t.logger().Warnf("failed to remove %q: %s", tag, err) 12 } 13 return nil 14 } 15 16 if err := t.ForEachTag(ctx, removeTag); err != nil { 17 return false, err 18 } 19 t.logger().Info("Removed") 20 return true, nil 21 }