1
0
mirror of https://github.com/containers/image.git synced 2025-04-18 19:44:05 +03:00

Reformat with Go 1.19's gofmt

This is just the minimal update: the gofmt-created
updates have been reviewed and edited to preserve original
semantic intent, but I didn't review all
existing comments to benefit from the new syntax.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač 2022-08-10 20:38:52 +02:00
parent 4af328291c
commit b3098b338e
13 changed files with 129 additions and 118 deletions

1
doc.go
View File

@ -27,7 +27,6 @@
// fmt.Printf("%s", string(b))
// }
//
//
// ## Notes on running in rootless mode
//
// If your application needs to access a containers/storage store in rootless

View File

@ -22,13 +22,14 @@ type Compat struct {
// for implementations of private.ImageDestination.
//
// Use it like this:
//
// type yourDestination struct {
// impl.Compat
// …
// }
//
// dest := &yourDestination{…}
// dest.Compat = impl.AddCompat(dest)
//
func AddCompat(dest private.ImageDestinationInternalOnly) Compat {
return Compat{dest}
}

View File

@ -3,15 +3,18 @@
// Compare with imagedestination/impl, which might require non-trivial implementation work.
//
// There are two kinds of stubs:
// - Pure stubs, like ImplementsPutBlobPartial. Those can just be included in an imageDestination
//
// First, there are pure stubs, like ImplementsPutBlobPartial. Those can just be included in an imageDestination
// implementation:
//
// type yourDestination struct {
// stubs.ImplementsPutBlobPartial
// …
// }
// - Stubs with a constructor, like NoPutBlobPartialInitialize. The Initialize marker
//
// Second, there are stubs with a constructor, like NoPutBlobPartialInitialize. The Initialize marker
// means that a constructor must be called:
//
// type yourDestination struct {
// stubs.NoPutBlobPartialInitialize
// …
@ -21,5 +24,4 @@
// …
// NoPutBlobPartialInitialize: stubs.NoPutBlobPartial(ref),
// }
//
package stubs

View File

@ -19,13 +19,14 @@ type Compat struct {
// for implementations of private.ImageSource.
//
// Use it like this:
//
// type yourSource struct {
// impl.Compat
// …
// }
//
// src := &yourSource{…}
// src.Compat = impl.AddCompat(src)
//
func AddCompat(src private.ImageSourceInternalOnly) Compat {
return Compat{src}
}

View File

@ -3,15 +3,19 @@
// Compare with imagesource/impl, which might require non-trivial implementation work.
//
// There are two kinds of stubs:
// - Pure stubs, like ImplementsGetBlobAt. Those can just be included in an ImageSource
//
// First, there are pure stubs, like ImplementsGetBlobAt. Those can just be included in an ImageSource
//
// implementation:
//
// type yourSource struct {
// stubs.ImplementsGetBlobAt
// …
// }
// - Stubs with a constructor, like NoGetBlobAtInitialize. The Initialize marker
//
// Second, there are stubs with a constructor, like NoGetBlobAtInitialize. The Initialize marker
// means that a constructor must be called:
// type yourSource struct {
// stubs.NoGetBlobAtInitialize
// …
@ -21,5 +25,4 @@
// …
// NoGetBlobAtInitialize: stubs.NoGetBlobAt(ref),
// }
//
package stubs

View File

@ -332,7 +332,7 @@ var (
errEmptyCluster = errors.New("cluster has no server defined")
)
//helper for checking certificate/key/CA
// helper for checking certificate/key/CA
func validateFileIsReadable(name string) error {
answer, err := os.Open(name)
defer func() {
@ -545,8 +545,10 @@ type clientConfigLoadingRules struct {
// Load is a modified copy of k8s.io/kubernetes/pkg/client/unversioned/clientcmd.ClientConfigLoadingRules.Load
// Load starts by running the MigrationRules and then
// takes the loading rules and returns a Config object based on following rules.
// if the ExplicitPath, return the unmerged explicit file
// Otherwise, return a merged config based on the Precedence slice
//
// - if the ExplicitPath, return the unmerged explicit file
// - Otherwise, return a merged config based on the Precedence slice
//
// A missing ExplicitPath file produces an error. Empty filenames or other missing files are ignored.
// Read errors or files with non-deserializable content produce errors.
// The first file to set a particular map key wins and map key's value is never changed.

View File

@ -20,8 +20,8 @@ import (
// short names.
//
// Examples:
// * short names: "image:tag", "library/fedora"
// * not short names: "quay.io/image", "localhost/image:tag",
// - short names: "image:tag", "library/fedora"
// - not short names: "quay.io/image", "localhost/image:tag",
// "server.org:5000/lib/image", "image@sha256:..."
func IsShortName(input string) bool {
isShort, _, _ := parseUnnormalizedShortName(input)
@ -402,9 +402,9 @@ func Resolve(ctx *types.SystemContext, name string) (*Resolved, error) {
// not a short name), it is returned as is. In case, it's a short name, the
// returned slice of named references looks as follows:
//
// 1) If present, the short-name alias
// 2) "localhost/" as used by many container engines such as Podman and Buildah
// 3) Unqualified-search registries from the registries.conf files
// 1. If present, the short-name alias
// 2. "localhost/" as used by many container engines such as Podman and Buildah
// 3. Unqualified-search registries from the registries.conf files
//
// Note that tags and digests are stripped from the specified name before
// looking up an alias. Stripped off tags and digests are later on appended to

View File

@ -72,6 +72,7 @@ func testNewReference(t *testing.T, fn func(string) (types.ImageReference, error
// refToTempFile creates a temporary file and returns a reference to it.
// The caller should
//
// defer os.Remove(tmpFile)
func refToTempFile(t *testing.T) (ref types.ImageReference, tmpDir string) {
f, err := os.CreateTemp("", "sif-transport-test")

View File

@ -2,6 +2,7 @@
// tarballs and an optional template configuration.
//
// An example:
//
// package main
//
// import (

View File

@ -177,6 +177,7 @@ type BICReplacementCandidate struct {
// BlobInfoCache records data useful for reusing blobs, or substituting equivalent ones, to avoid unnecessary blob copies.
//
// It records two kinds of data:
//
// - Sets of corresponding digest vs. uncompressed digest ("DiffID") pairs:
// One of the two digests is known to be uncompressed, and a single uncompressed digest may correspond to more than one compressed digest.
// This allows matching compressed layer blobs to existing local uncompressed layers (to avoid unnecessary download and decompression),