mirror of https://github.com/docker/docs.git
driverutil: uses SplitN to parse user input
Signed-off-by: André Carvalho <andre.carvalho@corp.globo.com>
This commit is contained in:
parent
a171962328
commit
716a8d133f
|
@ -5,7 +5,7 @@ import "strings"
|
||||||
// SplitPortProto splits a string in the format port/protocol, defaulting
|
// SplitPortProto splits a string in the format port/protocol, defaulting
|
||||||
// protocol to "tcp" if not provided.
|
// protocol to "tcp" if not provided.
|
||||||
func SplitPortProto(raw string) (port string, protocol string, err error) {
|
func SplitPortProto(raw string) (port string, protocol string, err error) {
|
||||||
parts := strings.Split(raw, "/")
|
parts := strings.SplitN(raw, "/", 2)
|
||||||
if len(parts) == 1 {
|
if len(parts) == 1 {
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue