Files
André Carvalho dd6aba6f35 driverutil: removes unused err return
Signed-off-by: André Carvalho <andre.carvalho@corp.globo.com>
2016-08-22 09:42:05 -03:00

14 lines
332 B
Go

package driverutil
import "strings"
// SplitPortProto splits a string in the format port/protocol, defaulting
// protocol to "tcp" if not provided.
func SplitPortProto(raw string) (port string, protocol string) {
parts := strings.SplitN(raw, "/", 2)
if len(parts) == 1 {
return parts[0], "tcp"
}
return parts[0], parts[1]
}