Use any instead of interface{}
It's available since Go 1.18 (see https://pkg.go.dev/builtin#any). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
3fc5c23095
commit
c3ff7f58df
|
|
@ -148,7 +148,7 @@ func main() {
|
||||||
|
|
||||||
// outputJSON formats its input as JSON to stdout, and returns values suitable
|
// outputJSON formats its input as JSON to stdout, and returns values suitable
|
||||||
// for directly returning from command.action
|
// for directly returning from command.action
|
||||||
func outputJSON(data interface{}) (int, error) {
|
func outputJSON(data any) (int, error) {
|
||||||
if err := json.NewEncoder(os.Stdout).Encode(data); err != nil {
|
if err := json.NewEncoder(os.Stdout).Encode(data); err != nil {
|
||||||
return 1, err
|
return 1, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ type Container struct {
|
||||||
UIDMap []idtools.IDMap `json:"uidmap,omitempty"`
|
UIDMap []idtools.IDMap `json:"uidmap,omitempty"`
|
||||||
GIDMap []idtools.IDMap `json:"gidmap,omitempty"`
|
GIDMap []idtools.IDMap `json:"gidmap,omitempty"`
|
||||||
|
|
||||||
Flags map[string]interface{} `json:"flags,omitempty"`
|
Flags map[string]any `json:"flags,omitempty"`
|
||||||
|
|
||||||
// volatileStore is true if the container is from the volatile json file
|
// volatileStore is true if the container is from the volatile json file
|
||||||
volatileStore bool `json:"-"`
|
volatileStore bool `json:"-"`
|
||||||
|
|
@ -196,7 +196,7 @@ func (c *Container) MountOpts() []string {
|
||||||
switch value := c.Flags[mountOptsFlag].(type) {
|
switch value := c.Flags[mountOptsFlag].(type) {
|
||||||
case []string:
|
case []string:
|
||||||
return value
|
return value
|
||||||
case []interface{}:
|
case []any:
|
||||||
var mountOpts []string
|
var mountOpts []string
|
||||||
for _, v := range value {
|
for _, v := range value {
|
||||||
if flag, ok := v.(string); ok {
|
if flag, ok := v.(string); ok {
|
||||||
|
|
@ -641,13 +641,13 @@ func (r *containerStore) ClearFlag(id string, flag string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requires startWriting.
|
// Requires startWriting.
|
||||||
func (r *containerStore) SetFlag(id string, flag string, value interface{}) error {
|
func (r *containerStore) SetFlag(id string, flag string, value any) error {
|
||||||
container, ok := r.lookup(id)
|
container, ok := r.lookup(id)
|
||||||
if !ok {
|
if !ok {
|
||||||
return ErrContainerUnknown
|
return ErrContainerUnknown
|
||||||
}
|
}
|
||||||
if container.Flags == nil {
|
if container.Flags == nil {
|
||||||
container.Flags = make(map[string]interface{})
|
container.Flags = make(map[string]any)
|
||||||
}
|
}
|
||||||
container.Flags[flag] = value
|
container.Flags[flag] = value
|
||||||
return r.saveFor(container)
|
return r.saveFor(container)
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ type LayerBigDataStore interface {
|
||||||
// Deprecated: There is no way to use this from any external user of c/storage to invoke c/storage functionality.
|
// Deprecated: There is no way to use this from any external user of c/storage to invoke c/storage functionality.
|
||||||
type FlaggableStore interface {
|
type FlaggableStore interface {
|
||||||
ClearFlag(id string, flag string) error
|
ClearFlag(id string, flag string) error
|
||||||
SetFlag(id string, flag string, value interface{}) error
|
SetFlag(id string, flag string, value any) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerStore is a deprecated interface with no documented way to use it from callers outside of c/storage.
|
// ContainerStore is a deprecated interface with no documented way to use it from callers outside of c/storage.
|
||||||
|
|
@ -195,8 +195,8 @@ type LayerStore interface {
|
||||||
FlaggableStore
|
FlaggableStore
|
||||||
RWLayerBigDataStore
|
RWLayerBigDataStore
|
||||||
Create(id string, parent *Layer, names []string, mountLabel string, options map[string]string, moreOptions *LayerOptions, writeable bool) (*Layer, error)
|
Create(id string, parent *Layer, names []string, mountLabel string, options map[string]string, moreOptions *LayerOptions, writeable bool) (*Layer, error)
|
||||||
CreateWithFlags(id string, parent *Layer, names []string, mountLabel string, options map[string]string, moreOptions *LayerOptions, writeable bool, flags map[string]interface{}) (layer *Layer, err error)
|
CreateWithFlags(id string, parent *Layer, names []string, mountLabel string, options map[string]string, moreOptions *LayerOptions, writeable bool, flags map[string]any) (layer *Layer, err error)
|
||||||
Put(id string, parent *Layer, names []string, mountLabel string, options map[string]string, moreOptions *LayerOptions, writeable bool, flags map[string]interface{}, diff io.Reader) (*Layer, int64, error)
|
Put(id string, parent *Layer, names []string, mountLabel string, options map[string]string, moreOptions *LayerOptions, writeable bool, flags map[string]any, diff io.Reader) (*Layer, int64, error)
|
||||||
SetNames(id string, names []string) error
|
SetNames(id string, names []string) error
|
||||||
AddNames(id string, names []string) error
|
AddNames(id string, names []string) error
|
||||||
RemoveNames(id string, names []string) error
|
RemoveNames(id string, names []string) error
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ type ApplyDiffOpts struct {
|
||||||
type ApplyDiffWithDifferOpts struct {
|
type ApplyDiffWithDifferOpts struct {
|
||||||
ApplyDiffOpts
|
ApplyDiffOpts
|
||||||
|
|
||||||
Flags map[string]interface{}
|
Flags map[string]any
|
||||||
}
|
}
|
||||||
|
|
||||||
// DedupArgs contains the information to perform storage deduplication.
|
// DedupArgs contains the information to perform storage deduplication.
|
||||||
|
|
@ -222,7 +222,7 @@ type DriverWithDifferOutput struct {
|
||||||
RootDirMode *os.FileMode
|
RootDirMode *os.FileMode
|
||||||
// Artifacts is a collection of additional artifacts
|
// Artifacts is a collection of additional artifacts
|
||||||
// generated by the differ that the storage driver can use.
|
// generated by the differ that the storage driver can use.
|
||||||
Artifacts map[string]interface{}
|
Artifacts map[string]any
|
||||||
}
|
}
|
||||||
|
|
||||||
type DifferOutputFormat int
|
type DifferOutputFormat int
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ func getComposefsBlob(dataDir string) string {
|
||||||
return filepath.Join(dataDir, "composefs.blob")
|
return filepath.Join(dataDir, "composefs.blob")
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateComposeFsBlob(verityDigests map[string]string, toc interface{}, composefsDir string) error {
|
func generateComposeFsBlob(verityDigests map[string]string, toc any, composefsDir string) error {
|
||||||
if err := os.MkdirAll(composefsDir, 0o700); err != nil {
|
if err := os.MkdirAll(composefsDir, 0o700); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ type Image struct {
|
||||||
// ReadOnly is true if this image resides in a read-only layer store.
|
// ReadOnly is true if this image resides in a read-only layer store.
|
||||||
ReadOnly bool `json:"-"`
|
ReadOnly bool `json:"-"`
|
||||||
|
|
||||||
Flags map[string]interface{} `json:"flags,omitempty"`
|
Flags map[string]any `json:"flags,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// roImageStore provides bookkeeping for information about Images.
|
// roImageStore provides bookkeeping for information about Images.
|
||||||
|
|
@ -675,7 +675,7 @@ func (r *imageStore) ClearFlag(id string, flag string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requires startWriting.
|
// Requires startWriting.
|
||||||
func (r *imageStore) SetFlag(id string, flag string, value interface{}) error {
|
func (r *imageStore) SetFlag(id string, flag string, value any) error {
|
||||||
if !r.lockfile.IsReadWrite() {
|
if !r.lockfile.IsReadWrite() {
|
||||||
return fmt.Errorf("not allowed to set flags on images at %q: %w", r.imagespath(), ErrStoreIsReadOnly)
|
return fmt.Errorf("not allowed to set flags on images at %q: %w", r.imagespath(), ErrStoreIsReadOnly)
|
||||||
}
|
}
|
||||||
|
|
@ -684,7 +684,7 @@ func (r *imageStore) SetFlag(id string, flag string, value interface{}) error {
|
||||||
return fmt.Errorf("locating image with ID %q: %w", id, ErrImageUnknown)
|
return fmt.Errorf("locating image with ID %q: %w", id, ErrImageUnknown)
|
||||||
}
|
}
|
||||||
if image.Flags == nil {
|
if image.Flags == nil {
|
||||||
image.Flags = make(map[string]interface{})
|
image.Flags = make(map[string]any)
|
||||||
}
|
}
|
||||||
image.Flags[flag] = value
|
image.Flags[flag] = value
|
||||||
return r.Save()
|
return r.Save()
|
||||||
|
|
|
||||||
12
layers.go
12
layers.go
|
|
@ -161,7 +161,7 @@ type Layer struct {
|
||||||
GIDs []uint32 `json:"gidset,omitempty"`
|
GIDs []uint32 `json:"gidset,omitempty"`
|
||||||
|
|
||||||
// Flags is arbitrary data about the layer.
|
// Flags is arbitrary data about the layer.
|
||||||
Flags map[string]interface{} `json:"flags,omitempty"`
|
Flags map[string]any `json:"flags,omitempty"`
|
||||||
|
|
||||||
// UIDMap and GIDMap are used for setting up a layer's contents
|
// UIDMap and GIDMap are used for setting up a layer's contents
|
||||||
// for use inside of a user namespace where UID mapping is being used.
|
// for use inside of a user namespace where UID mapping is being used.
|
||||||
|
|
@ -922,7 +922,7 @@ func (r *layerStore) load(lockedForWriting bool) (bool, error) {
|
||||||
var layersToDelete []*Layer
|
var layersToDelete []*Layer
|
||||||
for _, layer := range r.layers {
|
for _, layer := range r.layers {
|
||||||
if layer.Flags == nil {
|
if layer.Flags == nil {
|
||||||
layer.Flags = make(map[string]interface{})
|
layer.Flags = make(map[string]any)
|
||||||
}
|
}
|
||||||
if layerHasIncompleteFlag(layer) {
|
if layerHasIncompleteFlag(layer) {
|
||||||
// Important: Do not call r.deleteInternal() here. It modifies r.layers
|
// Important: Do not call r.deleteInternal() here. It modifies r.layers
|
||||||
|
|
@ -1261,7 +1261,7 @@ func (r *layerStore) ClearFlag(id string, flag string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requires startWriting.
|
// Requires startWriting.
|
||||||
func (r *layerStore) SetFlag(id string, flag string, value interface{}) error {
|
func (r *layerStore) SetFlag(id string, flag string, value any) error {
|
||||||
if !r.lockfile.IsReadWrite() {
|
if !r.lockfile.IsReadWrite() {
|
||||||
return fmt.Errorf("not allowed to set flags on layers at %q: %w", r.layerdir, ErrStoreIsReadOnly)
|
return fmt.Errorf("not allowed to set flags on layers at %q: %w", r.layerdir, ErrStoreIsReadOnly)
|
||||||
}
|
}
|
||||||
|
|
@ -1270,7 +1270,7 @@ func (r *layerStore) SetFlag(id string, flag string, value interface{}) error {
|
||||||
return ErrLayerUnknown
|
return ErrLayerUnknown
|
||||||
}
|
}
|
||||||
if layer.Flags == nil {
|
if layer.Flags == nil {
|
||||||
layer.Flags = make(map[string]interface{})
|
layer.Flags = make(map[string]any)
|
||||||
}
|
}
|
||||||
layer.Flags[flag] = value
|
layer.Flags[flag] = value
|
||||||
return r.saveFor(layer)
|
return r.saveFor(layer)
|
||||||
|
|
@ -1931,7 +1931,7 @@ func (r *layerStore) deleteInternal(id string) error {
|
||||||
// Ensure that if we are interrupted, the layer will be cleaned up.
|
// Ensure that if we are interrupted, the layer will be cleaned up.
|
||||||
if !layerHasIncompleteFlag(layer) {
|
if !layerHasIncompleteFlag(layer) {
|
||||||
if layer.Flags == nil {
|
if layer.Flags == nil {
|
||||||
layer.Flags = make(map[string]interface{})
|
layer.Flags = make(map[string]any)
|
||||||
}
|
}
|
||||||
layer.Flags[incompleteFlag] = true
|
layer.Flags[incompleteFlag] = true
|
||||||
if err := r.saveFor(layer); err != nil {
|
if err := r.saveFor(layer); err != nil {
|
||||||
|
|
@ -2540,7 +2540,7 @@ func (r *layerStore) applyDiffFromStagingDirectory(id string, diffOutput *driver
|
||||||
layer.Metadata = diffOutput.Metadata
|
layer.Metadata = diffOutput.Metadata
|
||||||
if options != nil && options.Flags != nil {
|
if options != nil && options.Flags != nil {
|
||||||
if layer.Flags == nil {
|
if layer.Flags == nil {
|
||||||
layer.Flags = make(map[string]interface{})
|
layer.Flags = make(map[string]any)
|
||||||
}
|
}
|
||||||
maps.Copy(layer.Flags, options.Flags)
|
maps.Copy(layer.Flags, options.Flags)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ type (
|
||||||
// This is additional data to be used by the converter. It will
|
// This is additional data to be used by the converter. It will
|
||||||
// not survive a round trip through JSON, so it's primarily
|
// not survive a round trip through JSON, so it's primarily
|
||||||
// intended for generating archives (i.e., converting writes).
|
// intended for generating archives (i.e., converting writes).
|
||||||
WhiteoutData interface{}
|
WhiteoutData any
|
||||||
// When unpacking, specifies whether overwriting a directory with a
|
// When unpacking, specifies whether overwriting a directory with a
|
||||||
// non-directory is allowed and vice versa.
|
// non-directory is allowed and vice versa.
|
||||||
NoOverwriteDirNonDir bool
|
NoOverwriteDirNonDir bool
|
||||||
|
|
@ -83,7 +83,7 @@ const (
|
||||||
freebsd = "freebsd"
|
freebsd = "freebsd"
|
||||||
)
|
)
|
||||||
|
|
||||||
var xattrsToIgnore = map[string]interface{}{
|
var xattrsToIgnore = map[string]any{
|
||||||
"security.selinux": true,
|
"security.selinux": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -378,7 +378,7 @@ type nosysFileInfo struct {
|
||||||
os.FileInfo
|
os.FileInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fi nosysFileInfo) Sys() interface{} {
|
func (fi nosysFileInfo) Sys() any {
|
||||||
// A Sys value of type *tar.Header is safe as it is system-independent.
|
// A Sys value of type *tar.Header is safe as it is system-independent.
|
||||||
// The tar.FileInfoHeader function copies the fields into the returned
|
// The tar.FileInfoHeader function copies the fields into the returned
|
||||||
// header without performing any OS lookups.
|
// header without performing any OS lookups.
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ func getOverlayOpaqueXattrName() string {
|
||||||
return GetOverlayXattrName("opaque")
|
return GetOverlayXattrName("opaque")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetWhiteoutConverter(format WhiteoutFormat, data interface{}) TarWhiteoutConverter {
|
func GetWhiteoutConverter(format WhiteoutFormat, data any) TarWhiteoutConverter {
|
||||||
if format == OverlayWhiteoutFormat {
|
if format == OverlayWhiteoutFormat {
|
||||||
if rolayers, ok := data.([]string); ok && len(rolayers) > 0 {
|
if rolayers, ok := data.([]string); ok && len(rolayers) > 0 {
|
||||||
return overlayWhiteoutConverter{rolayers: rolayers}
|
return overlayWhiteoutConverter{rolayers: rolayers}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ func chmodTarEntry(perm os.FileMode) os.FileMode {
|
||||||
return perm // noop for unix as golang APIs provide perm bits correctly
|
return perm // noop for unix as golang APIs provide perm bits correctly
|
||||||
}
|
}
|
||||||
|
|
||||||
func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat interface{}) (err error) {
|
func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat any) (err error) {
|
||||||
s, ok := stat.(*syscall.Stat_t)
|
s, ok := stat.(*syscall.Stat_t)
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
|
|
@ -82,7 +82,7 @@ func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat interface{}) (
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func getInodeFromStat(stat interface{}) (inode uint64, err error) {
|
func getInodeFromStat(stat any) (inode uint64, err error) {
|
||||||
s, ok := stat.(*syscall.Stat_t)
|
s, ok := stat.(*syscall.Stat_t)
|
||||||
|
|
||||||
if ok {
|
if ok {
|
||||||
|
|
@ -92,7 +92,7 @@ func getInodeFromStat(stat interface{}) (inode uint64, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func getFileUIDGID(stat interface{}) (idtools.IDPair, error) {
|
func getFileUIDGID(stat any) (idtools.IDPair, error) {
|
||||||
s, ok := stat.(*syscall.Stat_t)
|
s, ok := stat.(*syscall.Stat_t)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ func dumpNode(out io.Writer, added map[string]*minimal.FileMetadata, links map[s
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateDump generates a dump of the TOC in the same format as `composefs-info dump`
|
// GenerateDump generates a dump of the TOC in the same format as `composefs-info dump`
|
||||||
func GenerateDump(tocI interface{}, verityDigests map[string]string) (io.Reader, error) {
|
func GenerateDump(tocI any, verityDigests map[string]string) (io.Reader, error) {
|
||||||
toc, ok := tocI.(*minimal.TOC)
|
toc, ok := tocI.(*minimal.TOC)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("invalid TOC type")
|
return nil, fmt.Errorf("invalid TOC type")
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ type chunkedDiffer struct {
|
||||||
useFsVerity graphdriver.DifferFsVerity
|
useFsVerity graphdriver.DifferFsVerity
|
||||||
}
|
}
|
||||||
|
|
||||||
var xattrsToIgnore = map[string]interface{}{
|
var xattrsToIgnore = map[string]any{
|
||||||
"security.selinux": true,
|
"security.selinux": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1483,7 +1483,7 @@ func (c *chunkedDiffer) ApplyDiff(dest string, options *archive.TarOptions, diff
|
||||||
bigDataKey: c.manifest,
|
bigDataKey: c.manifest,
|
||||||
chunkedLayerDataKey: lcdBigData,
|
chunkedLayerDataKey: lcdBigData,
|
||||||
},
|
},
|
||||||
Artifacts: map[string]interface{}{
|
Artifacts: map[string]any{
|
||||||
tocKey: toc,
|
tocKey: toc,
|
||||||
},
|
},
|
||||||
TOCDigest: c.tocDigest,
|
TOCDigest: c.tocDigest,
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ func getBuffer(size int) *fixedBuffer {
|
||||||
bufPoolsLock.Lock()
|
bufPoolsLock.Lock()
|
||||||
pool, ok := bufPools[size]
|
pool, ok := bufPools[size]
|
||||||
if !ok {
|
if !ok {
|
||||||
pool = &sync.Pool{New: func() interface{} { return &fixedBuffer{buf: make([]byte, 0, size)} }}
|
pool = &sync.Pool{New: func() any { return &fixedBuffer{buf: make([]byte, 0, size)} }}
|
||||||
bufPools[size] = pool
|
bufPools[size] = pool
|
||||||
}
|
}
|
||||||
bufPoolsLock.Unlock()
|
bufPoolsLock.Unlock()
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ func (b *boolValue) Set(s string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *boolValue) Get() interface{} { return bool(*b) }
|
func (b *boolValue) Get() any { return bool(*b) }
|
||||||
|
|
||||||
func (b *boolValue) String() string { return fmt.Sprintf("%v", *b) }
|
func (b *boolValue) String() string { return fmt.Sprintf("%v", *b) }
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ func (i *intValue) Set(s string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *intValue) Get() interface{} { return int(*i) }
|
func (i *intValue) Get() any { return int(*i) }
|
||||||
|
|
||||||
func (i *intValue) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *intValue) String() string { return fmt.Sprintf("%v", *i) }
|
||||||
|
|
||||||
|
|
@ -161,7 +161,7 @@ func (i *int64Value) Set(s string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *int64Value) Get() interface{} { return int64(*i) }
|
func (i *int64Value) Get() any { return int64(*i) }
|
||||||
|
|
||||||
func (i *int64Value) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *int64Value) String() string { return fmt.Sprintf("%v", *i) }
|
||||||
|
|
||||||
|
|
@ -179,7 +179,7 @@ func (i *uintValue) Set(s string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *uintValue) Get() interface{} { return uint(*i) }
|
func (i *uintValue) Get() any { return uint(*i) }
|
||||||
|
|
||||||
func (i *uintValue) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *uintValue) String() string { return fmt.Sprintf("%v", *i) }
|
||||||
|
|
||||||
|
|
@ -197,7 +197,7 @@ func (i *uint64Value) Set(s string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *uint64Value) Get() interface{} { return uint64(*i) }
|
func (i *uint64Value) Get() any { return uint64(*i) }
|
||||||
|
|
||||||
func (i *uint64Value) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *uint64Value) String() string { return fmt.Sprintf("%v", *i) }
|
||||||
|
|
||||||
|
|
@ -215,7 +215,7 @@ func (i *uint16Value) Set(s string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *uint16Value) Get() interface{} { return uint16(*i) }
|
func (i *uint16Value) Get() any { return uint16(*i) }
|
||||||
|
|
||||||
func (i *uint16Value) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *uint16Value) String() string { return fmt.Sprintf("%v", *i) }
|
||||||
|
|
||||||
|
|
@ -232,7 +232,7 @@ func (s *stringValue) Set(val string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *stringValue) Get() interface{} { return string(*s) }
|
func (s *stringValue) Get() any { return string(*s) }
|
||||||
|
|
||||||
func (s *stringValue) String() string { return string(*s) }
|
func (s *stringValue) String() string { return string(*s) }
|
||||||
|
|
||||||
|
|
@ -250,7 +250,7 @@ func (f *float64Value) Set(s string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *float64Value) Get() interface{} { return float64(*f) }
|
func (f *float64Value) Get() any { return float64(*f) }
|
||||||
|
|
||||||
func (f *float64Value) String() string { return fmt.Sprintf("%v", *f) }
|
func (f *float64Value) String() string { return fmt.Sprintf("%v", *f) }
|
||||||
|
|
||||||
|
|
@ -268,7 +268,7 @@ func (d *durationValue) Set(s string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *durationValue) Get() interface{} { return time.Duration(*d) }
|
func (d *durationValue) Get() any { return time.Duration(*d) }
|
||||||
|
|
||||||
func (d *durationValue) String() string { return (*time.Duration)(d).String() }
|
func (d *durationValue) String() string { return (*time.Duration)(d).String() }
|
||||||
|
|
||||||
|
|
@ -289,7 +289,7 @@ type Value interface {
|
||||||
// by this package satisfy the Getter interface.
|
// by this package satisfy the Getter interface.
|
||||||
type Getter interface {
|
type Getter interface {
|
||||||
Value
|
Value
|
||||||
Get() interface{}
|
Get() any
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrorHandling defines how to handle flag parsing errors.
|
// ErrorHandling defines how to handle flag parsing errors.
|
||||||
|
|
@ -932,7 +932,7 @@ func Var(value Value, names []string, usage string) {
|
||||||
|
|
||||||
// failf prints to standard error a formatted error and usage message and
|
// failf prints to standard error a formatted error and usage message and
|
||||||
// returns the error.
|
// returns the error.
|
||||||
func (fs *FlagSet) failf(format string, a ...interface{}) error {
|
func (fs *FlagSet) failf(format string, a ...any) error {
|
||||||
err := fmt.Errorf(format, a...)
|
err := fmt.Errorf(format, a...)
|
||||||
fmt.Fprintln(fs.Out(), err)
|
fmt.Fprintln(fs.Out(), err)
|
||||||
if os.Args[0] == fs.name {
|
if os.Args[0] == fs.name {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ func init() {
|
||||||
// added here to be shared where required.
|
// added here to be shared where required.
|
||||||
func newBufioReaderPoolWithSize(size int) *BufioReaderPool {
|
func newBufioReaderPoolWithSize(size int) *BufioReaderPool {
|
||||||
pool := &sync.Pool{
|
pool := &sync.Pool{
|
||||||
New: func() interface{} { return bufio.NewReaderSize(nil, size) },
|
New: func() any { return bufio.NewReaderSize(nil, size) },
|
||||||
}
|
}
|
||||||
return &BufioReaderPool{pool: pool}
|
return &BufioReaderPool{pool: pool}
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +87,7 @@ type BufioWriterPool struct {
|
||||||
// added here to be shared where required.
|
// added here to be shared where required.
|
||||||
func newBufioWriterPoolWithSize(size int) *BufioWriterPool {
|
func newBufioWriterPoolWithSize(size int) *BufioWriterPool {
|
||||||
pool := &sync.Pool{
|
pool := &sync.Pool{
|
||||||
New: func() interface{} { return bufio.NewWriterSize(nil, size) },
|
New: func() any { return bufio.NewWriterSize(nil, size) },
|
||||||
}
|
}
|
||||||
return &BufioWriterPool{pool: pool}
|
return &BufioWriterPool{pool: pool}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -468,7 +468,7 @@ type Runnable interface {
|
||||||
Run() error
|
Run() error
|
||||||
}
|
}
|
||||||
|
|
||||||
func bailOnError(err error, format string, a ...interface{}) { // nolint: revive,goprintffuncname
|
func bailOnError(err error, format string, a ...any) { // nolint: revive,goprintffuncname
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if format != "" {
|
if format != "" {
|
||||||
logrus.Errorf("%s: %v", fmt.Sprintf(format, a...), err)
|
logrus.Errorf("%s: %v", fmt.Sprintf(format, a...), err)
|
||||||
|
|
|
||||||
12
store.go
12
store.go
|
|
@ -162,7 +162,7 @@ type flaggableStore interface {
|
||||||
ClearFlag(id string, flag string) error
|
ClearFlag(id string, flag string) error
|
||||||
|
|
||||||
// SetFlag sets a named flag and its value on an item in the store.
|
// SetFlag sets a named flag and its value on an item in the store.
|
||||||
SetFlag(id string, flag string, value interface{}) error
|
SetFlag(id string, flag string, value any) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoreOptions = types.StoreOptions
|
type StoreOptions = types.StoreOptions
|
||||||
|
|
@ -672,7 +672,7 @@ type LayerOptions struct {
|
||||||
// Flags is a set of named flags and their values to store with the layer.
|
// Flags is a set of named flags and their values to store with the layer.
|
||||||
// Currently these can only be set when the layer record is created, but that
|
// Currently these can only be set when the layer record is created, but that
|
||||||
// could change in the future.
|
// could change in the future.
|
||||||
Flags map[string]interface{}
|
Flags map[string]any
|
||||||
}
|
}
|
||||||
|
|
||||||
type LayerBigDataOption struct {
|
type LayerBigDataOption struct {
|
||||||
|
|
@ -700,7 +700,7 @@ type ImageOptions struct {
|
||||||
NamesHistory []string
|
NamesHistory []string
|
||||||
// Flags is a set of named flags and their values to store with the image. Currently these can only
|
// Flags is a set of named flags and their values to store with the image. Currently these can only
|
||||||
// be set when the image record is created, but that could change in the future.
|
// be set when the image record is created, but that could change in the future.
|
||||||
Flags map[string]interface{}
|
Flags map[string]any
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageBigDataOption struct {
|
type ImageBigDataOption struct {
|
||||||
|
|
@ -720,7 +720,7 @@ type ContainerOptions struct {
|
||||||
// Flags is a set of named flags and their values to store with the container.
|
// Flags is a set of named flags and their values to store with the container.
|
||||||
// Currently these can only be set when the container record is created, but that
|
// Currently these can only be set when the container record is created, but that
|
||||||
// could change in the future.
|
// could change in the future.
|
||||||
Flags map[string]interface{}
|
Flags map[string]any
|
||||||
MountOpts []string
|
MountOpts []string
|
||||||
Volatile bool
|
Volatile bool
|
||||||
StorageOpt map[string]string
|
StorageOpt map[string]string
|
||||||
|
|
@ -1649,7 +1649,7 @@ func (s *store) CreateImage(id string, names []string, layer, metadata string, i
|
||||||
options.BigData = append(options.BigData, copyImageBigDataOptionSlice(iOptions.BigData)...)
|
options.BigData = append(options.BigData, copyImageBigDataOptionSlice(iOptions.BigData)...)
|
||||||
options.NamesHistory = append(options.NamesHistory, iOptions.NamesHistory...)
|
options.NamesHistory = append(options.NamesHistory, iOptions.NamesHistory...)
|
||||||
if options.Flags == nil {
|
if options.Flags == nil {
|
||||||
options.Flags = make(map[string]interface{})
|
options.Flags = make(map[string]any)
|
||||||
}
|
}
|
||||||
maps.Copy(options.Flags, iOptions.Flags)
|
maps.Copy(options.Flags, iOptions.Flags)
|
||||||
}
|
}
|
||||||
|
|
@ -1918,7 +1918,7 @@ func (s *store) CreateContainer(id string, names []string, image, layer, metadat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if options.Flags == nil {
|
if options.Flags == nil {
|
||||||
options.Flags = make(map[string]interface{})
|
options.Flags = make(map[string]any)
|
||||||
}
|
}
|
||||||
plabel, _ := options.Flags[processLabelFlag].(string)
|
plabel, _ := options.Flags[processLabelFlag].(string)
|
||||||
mlabel, _ := options.Flags[mountLabelFlag].(string)
|
mlabel, _ := options.Flags[mountLabelFlag].(string)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue