Skip to content

Commit 07795b6

Browse files
committed
incusd: Rename variables because they collide with builtin function names
Signed-off-by: karo <[email protected]>
1 parent 9279f5f commit 07795b6

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

internal/server/config/safe.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ func SafeLoad(schema Schema, values map[string]string) (Map, error) {
1717
return m, err
1818
}
1919

20-
for _, error := range errors {
21-
message := fmt.Sprintf("Invalid configuration key: %s", error.Reason)
22-
logger.Error(message, logger.Ctx{"key": error.Name})
20+
for _, e := range errors {
21+
message := fmt.Sprintf("Invalid configuration key: %s", e.Reason)
22+
logger.Error(message, logger.Ctx{"key": e.Name})
2323
}
2424
}
2525

internal/server/instance/drivers/driver_qemu_templates.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -529,13 +529,13 @@ func qemuCPU(opts *qemuCPUOpts, pinning bool) []cfg.Section {
529529
}
530530

531531
// Cap the max number of CPUs to 64 unless directly assigned more.
532-
max := 64
533-
if int(cpu.Total) < max {
534-
max = int(cpu.Total)
535-
} else if opts.cpuRequested > max {
536-
max = opts.cpuRequested
537-
} else if opts.cpuCount > max {
538-
max = opts.cpuCount
532+
maxCpus := 64
533+
if int(cpu.Total) < maxCpus {
534+
maxCpus = int(cpu.Total)
535+
} else if opts.cpuRequested > maxCpus {
536+
maxCpus = opts.cpuRequested
537+
} else if opts.cpuCount > maxCpus {
538+
maxCpus = opts.cpuCount
539539
}
540540

541541
entries = append(entries, cfg.Entry{

internal/server/network/network_utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,14 +1334,14 @@ func ParseIPCIDRToNet(ipAddressCIDR string) (*net.IPNet, error) {
13341334

13351335
// IPToNet converts an IP to a single host IPNet.
13361336
func IPToNet(ip net.IP) net.IPNet {
1337-
len := 32
1337+
bits := 32
13381338
if ip.To4() == nil {
1339-
len = 128
1339+
bits = 128
13401340
}
13411341

13421342
return net.IPNet{
13431343
IP: ip,
1344-
Mask: net.CIDRMask(len, len),
1344+
Mask: net.CIDRMask(bits, bits),
13451345
}
13461346
}
13471347

0 commit comments

Comments
 (0)