Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -46,7 +46,8 @@ func TestImageHistory(t *testing.T) {
|
| 46 | 46 |
ID: "image_id2", |
| 47 | 47 |
Tags: []string{"tag1", "tag2"},
|
| 48 | 48 |
}, |
| 49 |
- }} |
|
| 49 |
+ }, |
|
| 50 |
+ } |
|
| 50 | 51 |
|
| 51 | 52 |
imageHistories, err := client.ImageHistory(context.Background(), "image_id", ImageHistoryWithPlatform(ocispec.Platform{
|
| 52 | 53 |
Architecture: "arm64", |
| ... | ... |
@@ -23,10 +23,10 @@ type ImagePullResponse interface {
|
| 23 | 23 |
// It executes the privileged function if the operation is unauthorized |
| 24 | 24 |
// and it tries one more time. |
| 25 | 25 |
// Callers can: |
| 26 |
-// - use [ImagePullResponse.Wait] to wait for pull to complete |
|
| 27 |
-// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence |
|
| 28 |
-// of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case. |
|
| 29 |
-// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing. |
|
| 26 |
+// - use [ImagePullResponse.Wait] to wait for pull to complete |
|
| 27 |
+// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence |
|
| 28 |
+// of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case. |
|
| 29 |
+// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing. |
|
| 30 | 30 |
func (cli *Client) ImagePull(ctx context.Context, refStr string, options ImagePullOptions) (ImagePullResponse, error) {
|
| 31 | 31 |
// FIXME(vdemeester): there is currently used in a few way in docker/docker |
| 32 | 32 |
// - if not in trusted content, ref is used to pass the whole reference, and tag is empty |
| ... | ... |
@@ -27,10 +27,10 @@ type ImagePushResponse interface {
|
| 27 | 27 |
// It executes the privileged function if the operation is unauthorized |
| 28 | 28 |
// and it tries one more time. |
| 29 | 29 |
// Callers can |
| 30 |
-// - use [ImagePushResponse.Wait] to wait for push to complete |
|
| 31 |
-// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence |
|
| 32 |
-// of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case. |
|
| 33 |
-// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing. |
|
| 30 |
+// - use [ImagePushResponse.Wait] to wait for push to complete |
|
| 31 |
+// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence |
|
| 32 |
+// of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case. |
|
| 33 |
+// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing. |
|
| 34 | 34 |
func (cli *Client) ImagePush(ctx context.Context, image string, options ImagePushOptions) (ImagePushResponse, error) {
|
| 35 | 35 |
ref, err := reference.ParseNormalizedNamed(image) |
| 36 | 36 |
if err != nil {
|
| ... | ... |
@@ -195,7 +195,7 @@ type JSONMessagesStream iter.Seq2[JSONMessage, error] |
| 195 | 195 |
// each [JSONMessage] to out. |
| 196 | 196 |
// see DisplayJSONMessages for details |
| 197 | 197 |
func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
|
| 198 |
- var dec = json.NewDecoder(in) |
|
| 198 |
+ dec := json.NewDecoder(in) |
|
| 199 | 199 |
var f JSONMessagesStream = func(yield func(JSONMessage, error) bool) {
|
| 200 | 200 |
for {
|
| 201 | 201 |
var jm JSONMessage |
| ... | ... |
@@ -229,7 +229,7 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, |
| 229 | 229 |
// called if a JSONMessage contains an Aux field, in which case |
| 230 | 230 |
// DisplayJSONMessagesStream does not present the JSONMessage. |
| 231 | 231 |
func DisplayJSONMessages(messages JSONMessagesStream, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
|
| 232 |
- var ids = make(map[string]uint) |
|
| 232 |
+ ids := make(map[string]uint) |
|
| 233 | 233 |
|
| 234 | 234 |
for jm, err := range messages {
|
| 235 | 235 |
var diff uint |
| ... | ... |
@@ -23,10 +23,10 @@ type ImagePullResponse interface {
|
| 23 | 23 |
// It executes the privileged function if the operation is unauthorized |
| 24 | 24 |
// and it tries one more time. |
| 25 | 25 |
// Callers can: |
| 26 |
-// - use [ImagePullResponse.Wait] to wait for pull to complete |
|
| 27 |
-// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence |
|
| 28 |
-// of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case. |
|
| 29 |
-// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing. |
|
| 26 |
+// - use [ImagePullResponse.Wait] to wait for pull to complete |
|
| 27 |
+// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence |
|
| 28 |
+// of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case. |
|
| 29 |
+// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing. |
|
| 30 | 30 |
func (cli *Client) ImagePull(ctx context.Context, refStr string, options ImagePullOptions) (ImagePullResponse, error) {
|
| 31 | 31 |
// FIXME(vdemeester): there is currently used in a few way in docker/docker |
| 32 | 32 |
// - if not in trusted content, ref is used to pass the whole reference, and tag is empty |
| ... | ... |
@@ -27,10 +27,10 @@ type ImagePushResponse interface {
|
| 27 | 27 |
// It executes the privileged function if the operation is unauthorized |
| 28 | 28 |
// and it tries one more time. |
| 29 | 29 |
// Callers can |
| 30 |
-// - use [ImagePushResponse.Wait] to wait for push to complete |
|
| 31 |
-// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence |
|
| 32 |
-// of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case. |
|
| 33 |
-// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing. |
|
| 30 |
+// - use [ImagePushResponse.Wait] to wait for push to complete |
|
| 31 |
+// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence |
|
| 32 |
+// of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case. |
|
| 33 |
+// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing. |
|
| 34 | 34 |
func (cli *Client) ImagePush(ctx context.Context, image string, options ImagePushOptions) (ImagePushResponse, error) {
|
| 35 | 35 |
ref, err := reference.ParseNormalizedNamed(image) |
| 36 | 36 |
if err != nil {
|
| ... | ... |
@@ -195,7 +195,7 @@ type JSONMessagesStream iter.Seq2[JSONMessage, error] |
| 195 | 195 |
// each [JSONMessage] to out. |
| 196 | 196 |
// see DisplayJSONMessages for details |
| 197 | 197 |
func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
|
| 198 |
- var dec = json.NewDecoder(in) |
|
| 198 |
+ dec := json.NewDecoder(in) |
|
| 199 | 199 |
var f JSONMessagesStream = func(yield func(JSONMessage, error) bool) {
|
| 200 | 200 |
for {
|
| 201 | 201 |
var jm JSONMessage |
| ... | ... |
@@ -229,7 +229,7 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, |
| 229 | 229 |
// called if a JSONMessage contains an Aux field, in which case |
| 230 | 230 |
// DisplayJSONMessagesStream does not present the JSONMessage. |
| 231 | 231 |
func DisplayJSONMessages(messages JSONMessagesStream, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
|
| 232 |
- var ids = make(map[string]uint) |
|
| 232 |
+ ids := make(map[string]uint) |
|
| 233 | 233 |
|
| 234 | 234 |
for jm, err := range messages {
|
| 235 | 235 |
var diff uint |