Skip to content

Commit

Permalink
code clean
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <[email protected]>
  • Loading branch information
qweeah committed Feb 21, 2023
1 parent d75d57b commit b5a1891
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/oras/internal/option/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (opts *Remote) ApplyFlagsWithPrefix(fs *pflag.FlagSet, prefix, description
}

if fs.Lookup("resolve") == nil {
fs.StringArrayVarP(&opts.resolveFlag, "resolve", "", nil, "customized DNS formatted in `host:port:address[:port]`")
fs.StringArrayVarP(&opts.resolveFlag, "resolve", "", nil, "customized DNS formatted in `host:port:toIp[:toPort]`")
}
}

Expand Down Expand Up @@ -151,14 +151,14 @@ func (opts *Remote) parseResolve() error {
host := parts[0]
port, err := strconv.Atoi(parts[1])
if err != nil {
return formatError(r, "expecting uint64 destination Port")
return formatError(r, "expecting uint64 host port")
}

ip, hostPort, found := strings.Cut(parts[2], ":")
if found {
_, err := strconv.Atoi(hostPort)
if err != nil {
return formatError(r, "expecting uint64 source port")
return formatError(r, "expecting uint64 address port")
}
host += fmt.Sprintf(":%s", hostPort)
}
Expand Down

0 comments on commit b5a1891

Please sign in to comment.