use strings.SplitN to avoid the join

This commit is contained in:
Benjamin Nørgaard 2018-10-03 14:23:53 +02:00
parent 261ed76405
commit 038dcc1958
No known key found for this signature in database
GPG Key ID: E683F039987FFD17
1 changed files with 2 additions and 3 deletions

View File

@ -29,12 +29,11 @@ type BuildArgs struct {
func NewBuildArgs(args []string) *BuildArgs {
argsFromOptions := make(map[string]*string)
for _, a := range args {
s := strings.Split(a, "=")
s := strings.SplitN(a, "=", 2)
if len(s) == 1 {
argsFromOptions[s[0]] = nil
} else {
val := strings.Join(s[1:], "=")
argsFromOptions[s[0]] = &val
argsFromOptions[s[0]] = &s[1]
}
}
return &BuildArgs{