oras-project / oras-go

ORAS Go library

Home Page:https://oras.land

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rename `ErrSkipDesc` to `SkipNode`

shizhMSFT opened this issue · comments

#631 exports errSkipDesc to ErrSkipDesc so that copy can be skipped for mounting. However, ErrSkipDesc is not a real error that should be returned by any function.

I have looked into the golang built-in package io/fs and found SkipAll and SkipDir. To have consistent naming as the build-in packages, I propose that we should rename ErrSkipDesc to SkipDesc SkipNode (as discussed in comment section).

var SkipAll = errors.New("skip everything and stop the walk")
var SkipDir = errors.New("skip this directory")

@Wwwsylvia @ktarplee Any comments?

@shizhMSFT I do like the name SkipDesc better than ErrSkipDesc but maybe the abbreviation needs to be dropped as well. So I actually prefer SkipDescriptor for clarity.

SkipDescriptor sounds good to me.

Maybe SkipNode is a better name since we are actually skipping the node described by the descriptor and not the descriptor itself.

For API choices it always easier when we look at it in the context of code. Can we write up a small code block that would use SkipNode or skipDescriptor?

For API choices it always easier when we look at it in the context of code. Can we write up a small code block that would use SkipNode or skipDescriptor?

You see a use of ErrSkipDesc in #632

The name SkipNode sound more reasonable to me as we are copying graphs.

SkipNode sounds good to me.