Skip to content

Commit

Permalink
Apply PR suggestions from @tonistiigi
Browse files Browse the repository at this point in the history
Signed-off-by: Sune Keller <[email protected]>
  • Loading branch information
sirlatrom committed Oct 28, 2019
1 parent 0abfd0e commit 6dfcdda
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions commands/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ func csvToMap(in []string) (map[string]string, error) {
}
for _, v := range fields {
p := strings.SplitN(v, "=", 2)
if len(p) < 2 {
if len(p) != 2 {
return nil, errors.Errorf("invalid value %q, expecting k=v", v)
}
m[p[0]] = strings.Join(p[1:], "=")
m[p[0]] = p[1]
}
}
return m, nil
Expand Down
4 changes: 2 additions & 2 deletions driver/docker-container/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func (f *factory) New(ctx context.Context, cfg driver.InitConfig) (driver.Driver
case k == "image":
d.image = v
case strings.HasPrefix(k, "env."):
envName := k[4:]
if len(envName) == 0 {
envName := strings.TrimPrefix(k, "env.")
if envName == "" {
return nil, errors.Errorf("invalid env option %q, expecting env.FOO=bar", k)
}
d.env = append(d.env, fmt.Sprintf("%s=%s", envName, v))
Expand Down

0 comments on commit 6dfcdda

Please sign in to comment.