mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
registry: trimV1Address(): simplify trimming trailing slash
strings.TrimSuffix() does exactly the same as this code, but is
a bit more readable.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4a52c46e37
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
ae3a9337dd
commit
50361d91a6
1 changed files with 1 additions and 4 deletions
|
@ -89,10 +89,7 @@ func trimV1Address(address string) (string, error) {
|
||||||
apiVersionStr string
|
apiVersionStr string
|
||||||
)
|
)
|
||||||
|
|
||||||
if strings.HasSuffix(address, "/") {
|
address = strings.TrimSuffix(address, "/")
|
||||||
address = address[:len(address)-1]
|
|
||||||
}
|
|
||||||
|
|
||||||
chunks = strings.Split(address, "/")
|
chunks = strings.Split(address, "/")
|
||||||
apiVersionStr = chunks[len(chunks)-1]
|
apiVersionStr = chunks[len(chunks)-1]
|
||||||
if apiVersionStr == "v1" {
|
if apiVersionStr == "v1" {
|
||||||
|
|
Loading…
Reference in a new issue