mirror of
https://github.com/docker/cli.git
synced 2026-09-27 17:56:04 -04:00
+4
-2
@@ -1,3 +1,6 @@
|
||||
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
|
||||
//go:build go1.26
|
||||
|
||||
package opts
|
||||
|
||||
import (
|
||||
@@ -21,8 +24,7 @@ func parseCount(s string) (int, error) {
|
||||
}
|
||||
i, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
var numErr *strconv.NumError
|
||||
if errors.As(err, &numErr) {
|
||||
if numErr, ok := errors.AsType[*strconv.NumError](err); ok {
|
||||
err = numErr.Err
|
||||
}
|
||||
return 0, fmt.Errorf(`invalid count (%s): value must be either "all" or an integer: %w`, s, err)
|
||||
|
||||
+4
-2
@@ -1,3 +1,6 @@
|
||||
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
|
||||
//go:build go1.26
|
||||
|
||||
package opts
|
||||
|
||||
import (
|
||||
@@ -100,8 +103,7 @@ func (n *NetworkOpt) Set(value string) error { //nolint:gocyclo
|
||||
case gwPriorityOpt:
|
||||
netOpt.GwPriority, err = strconv.Atoi(val)
|
||||
if err != nil {
|
||||
var numErr *strconv.NumError
|
||||
if errors.As(err, &numErr) {
|
||||
if numErr, ok := errors.AsType[*strconv.NumError](err); ok {
|
||||
err = numErr.Err
|
||||
}
|
||||
return fmt.Errorf("invalid gw-priority (%s): %w", val, err)
|
||||
|
||||
@@ -73,8 +73,7 @@ func (p *PortOpt) Set(value string) error {
|
||||
case portOptTargetPort:
|
||||
tPort, err := strconv.ParseUint(val, 10, 16)
|
||||
if err != nil {
|
||||
var numErr *strconv.NumError
|
||||
if errors.As(err, &numErr) {
|
||||
if numErr, ok := errors.AsType[*strconv.NumError](err); ok {
|
||||
err = numErr.Err
|
||||
}
|
||||
return fmt.Errorf("invalid target port (%s): value must be an integer: %w", val, err)
|
||||
@@ -84,8 +83,7 @@ func (p *PortOpt) Set(value string) error {
|
||||
case portOptPublishedPort:
|
||||
pPort, err := strconv.ParseUint(val, 10, 16)
|
||||
if err != nil {
|
||||
var numErr *strconv.NumError
|
||||
if errors.As(err, &numErr) {
|
||||
if numErr, ok := errors.AsType[*strconv.NumError](err); ok {
|
||||
err = numErr.Err
|
||||
}
|
||||
return fmt.Errorf("invalid published port (%s): value must be an integer: %w", val, err)
|
||||
|
||||
Reference in New Issue
Block a user