Add a leading space after the comment sign

Fix coding standards

Signed-off-by: Tony Fang <nhfang@amazon.com>
This commit is contained in:
Tony Fang 2023-02-26 01:41:47 +00:00
parent f53417921d
commit 8a47c6910f
5 changed files with 20 additions and 20 deletions

View File

@ -130,10 +130,10 @@ If foobar.tar contains an OCI ref named "latest" and anonymous ref "sha256:deadb
} }
var platSpec ocispec.Platform var platSpec ocispec.Platform
//Only when all-platforms not specified, we will check platform value // Only when all-platforms not specified, we will check platform value
//Implicitly if the platforms is empty, it means all-platforms // Implicitly if the platforms is empty, it means all-platforms
if !context.Bool("all-platforms") { if !context.Bool("all-platforms") {
//If platform specified, use that one, if not use default // If platform specified, use that one, if not use default
if platform := context.String("platform"); platform != "" { if platform := context.String("platform"); platform != "" {
platSpec, err = platforms.Parse(platform) platSpec, err = platforms.Parse(platform)
if err != nil { if err != nil {
@ -147,12 +147,12 @@ If foobar.tar contains an OCI ref named "latest" and anonymous ref "sha256:deadb
if !context.Bool("no-unpack") { if !context.Bool("no-unpack") {
snapshotter := context.String("snapshotter") snapshotter := context.String("snapshotter")
//If OS field is not empty, it means platSpec was updated in the above block // If OS field is not empty, it means platSpec was updated in the above block
//i.e all-platforms was not specified // i.e all-platforms was not specified
if platSpec.OS != "" { if platSpec.OS != "" {
opts = append(opts, image.WithUnpack(platSpec, snapshotter)) opts = append(opts, image.WithUnpack(platSpec, snapshotter))
} else { } else {
//empty spec means all platforms // Empty spec means all platforms
var emptySpec ocispec.Platform var emptySpec ocispec.Platform
opts = append(opts, image.WithUnpack(emptySpec, snapshotter)) opts = append(opts, image.WithUnpack(emptySpec, snapshotter))
} }

View File

@ -114,7 +114,7 @@ command. As part of this process, we do the following:
} }
sopts = append(sopts, image.WithPlatforms(p...)) sopts = append(sopts, image.WithPlatforms(p...))
//set unpack configuration // Set unpack configuration
for _, platform := range p { for _, platform := range p {
sopts = append(sopts, image.WithUnpack(platform, context.String("snapshotter"))) sopts = append(sopts, image.WithUnpack(platform, context.String("snapshotter")))
} }
@ -125,8 +125,8 @@ command. As part of this process, we do the following:
if context.Bool("metadata-only") { if context.Bool("metadata-only") {
sopts = append(sopts, image.WithAllMetadata) sopts = append(sopts, image.WithAllMetadata)
// Any with an empty set is None // Any with an empty set is None
// TODO: Specify way to specify not default platorm // TODO: Specify way to specify not default platform
//config.PlatformMatcher = platforms.Any() // config.PlatformMatcher = platforms.Any()
} else if context.Bool("all-metadata") { } else if context.Bool("all-metadata") {
sopts = append(sopts, image.WithAllMetadata) sopts = append(sopts, image.WithAllMetadata)
} }

View File

@ -89,7 +89,7 @@ func (ts *localTransferService) importStream(ctx context.Context, i transfer.Ima
handler = images.Handlers(handlerFunc) handler = images.Handlers(handlerFunc)
// First find suitable platforms to unpack into // First find suitable platforms to unpack into
//If image storer is also an unpacker type, i.e implemented UnpackPlatforms() func // If image storer is also an unpacker type, i.e implemented UnpackPlatforms() func
if iu, ok := is.(transfer.ImageUnpacker); ok { if iu, ok := is.(transfer.ImageUnpacker); ok {
unpacks := iu.UnpackPlatforms() unpacks := iu.UnpackPlatforms()
if len(unpacks) > 0 { if len(unpacks) > 0 {

View File

@ -116,7 +116,7 @@ func (ts *localTransferService) pull(ctx context.Context, ir transfer.ImageFetch
return err return err
} }
//Set up baseHandlers from service configuration if present or create a new one // Set up baseHandlers from service configuration if present or create a new one
if ts.config.BaseHandlers != nil { if ts.config.BaseHandlers != nil {
baseHandlers = ts.config.BaseHandlers baseHandlers = ts.config.BaseHandlers
} else { } else {
@ -151,12 +151,12 @@ func (ts *localTransferService) pull(ctx context.Context, ir transfer.ImageFetch
)...) )...)
// First find suitable platforms to unpack into // First find suitable platforms to unpack into
//If image storer is also an unpacker type, i.e implemented UnpackPlatforms() func // If image storer is also an unpacker type, i.e implemented UnpackPlatforms() func
if iu, ok := is.(transfer.ImageUnpacker); ok { if iu, ok := is.(transfer.ImageUnpacker); ok {
unpacks := iu.UnpackPlatforms() unpacks := iu.UnpackPlatforms()
if len(unpacks) > 0 { if len(unpacks) > 0 {
uopts := []unpack.UnpackerOpt{} uopts := []unpack.UnpackerOpt{}
//Only unpack if requested unpackconfig matches default/supported unpackconfigs // Only unpack if requested unpackconfig matches default/supported unpackconfigs
for _, u := range unpacks { for _, u := range unpacks {
matched, mu := getSupportedPlatform(u, ts.config.UnpackPlatforms) matched, mu := getSupportedPlatform(u, ts.config.UnpackPlatforms)
if matched { if matched {
@ -254,11 +254,11 @@ func fetchHandler(ingester content.Ingester, fetcher remotes.Fetcher, pt *Progre
func getSupportedPlatform(uc transfer.UnpackConfiguration, supportedPlatforms []unpack.Platform) (bool, unpack.Platform) { func getSupportedPlatform(uc transfer.UnpackConfiguration, supportedPlatforms []unpack.Platform) (bool, unpack.Platform) {
var u unpack.Platform var u unpack.Platform
for _, sp := range supportedPlatforms { for _, sp := range supportedPlatforms {
//If both platform and snapshotter match, return the supportPlatform // If both platform and snapshotter match, return the supportPlatform
//If platform matched and SnapshotterKey is empty, we assume client didn't pass SnapshotterKey // If platform matched and SnapshotterKey is empty, we assume client didn't pass SnapshotterKey
//use default Snapshotter // use default Snapshotter
if sp.Platform.Match(uc.Platform) { if sp.Platform.Match(uc.Platform) {
//assuming sp.SnapshotterKey is not empty // Assume sp.SnapshotterKey is not empty
if uc.Snapshotter == sp.SnapshotterKey { if uc.Snapshotter == sp.SnapshotterKey {
return true, sp return true, sp
} else if uc.Snapshotter == "" && sp.SnapshotterKey == containerd.DefaultSnapshotter { } else if uc.Snapshotter == "" && sp.SnapshotterKey == containerd.DefaultSnapshotter {

View File

@ -39,9 +39,9 @@ type localTransferService struct {
leases leases.Manager leases leases.Manager
content content.Store content content.Store
images images.Store images images.Store
//limiter for upload // limiter for upload
limiterU *semaphore.Weighted limiterU *semaphore.Weighted
//limiter for download operation // limiter for download operation
limiterD *semaphore.Weighted limiterD *semaphore.Weighted
config TransferConfig config TransferConfig
} }
@ -168,7 +168,7 @@ type TransferConfig struct {
// handlers. // handlers.
BaseHandlers []images.Handler BaseHandlers []images.Handler
//UnpackPlatforms are used to specify supported combination of platforms and snapshotters // UnpackPlatforms are used to specify supported combination of platforms and snapshotters
UnpackPlatforms []unpack.Platform `toml:"unpack_platforms"` UnpackPlatforms []unpack.Platform `toml:"unpack_platforms"`
// RegistryConfigPath is a path to the root directory containing registry-specific configurations // RegistryConfigPath is a path to the root directory containing registry-specific configurations