Skip to content

Commit

Permalink
lxd/instance/drivers: Use Cut instead of SplitN
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <[email protected]>
  • Loading branch information
hamistao committed Feb 3, 2025
1 parent 92aeeb7 commit 08aa340
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lxd/instance/drivers/driver_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -1577,14 +1577,13 @@ func (d *common) devicesUpdate(inst instance.Instance, removeDevices deviceConfi
var source string

for _, opt := range runConf.Mounts[0].Opts {
if strings.HasPrefix(opt, "mountTag=") {
parts := strings.SplitN(opt, "=", 2)

if len(parts) < 2 {
key, value, _ := strings.Cut(opt, "=")
if key == "mountTag" {
if value == "" {
return nil, errors.New("Empty mountTag on device mount options")
}

source = parts[1]
source = value
}
}

Expand Down

0 comments on commit 08aa340

Please sign in to comment.