(u Platform)
| 110 | type UnpackerOpt func(*unpackerConfig) error |
| 111 | |
| 112 | func WithUnpackPlatform(u Platform) UnpackerOpt { |
| 113 | return UnpackerOpt(func(c *unpackerConfig) error { |
| 114 | if u.Platform == nil { |
| 115 | u.Platform = platforms.All |
| 116 | } |
| 117 | if u.Snapshotter == nil { |
| 118 | return fmt.Errorf("snapshotter must be provided to unpack") |
| 119 | } |
| 120 | if u.SnapshotterKey == "" { |
| 121 | if s, ok := u.Snapshotter.(fmt.Stringer); ok { |
| 122 | u.SnapshotterKey = s.String() |
| 123 | } else { |
| 124 | u.SnapshotterKey = "unknown" |
| 125 | } |
| 126 | } |
| 127 | if u.Applier == nil { |
| 128 | return fmt.Errorf("applier must be provided to unpack") |
| 129 | } |
| 130 | |
| 131 | c.platforms = append(c.platforms, &u) |
| 132 | |
| 133 | return nil |
| 134 | }) |
| 135 | } |
| 136 | |
| 137 | func WithLimiter(l Limiter) UnpackerOpt { |
| 138 | return UnpackerOpt(func(c *unpackerConfig) error { |
no test coverage detected
searching dependent graphs…