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>
This commit is contained in:
parent
542edf0c21
commit
4a52c46e37
1 changed files with 1 additions and 4 deletions
|
@ -77,10 +77,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