Skip to content

Commit 3ad14f6

Browse files
committed
Move qemu/qemuconst → qemu/const and put it into the qemu namespace
We don't need a separate package declaration, we just need a separate import path to avoid the cyclical references. Signed-off-by: Jan Dubois <[email protected]>
1 parent 371198f commit 3ad14f6

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

pkg/cidata/cidata.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/lima-vm/lima/pkg/limayaml"
1717
"github.com/lima-vm/lima/pkg/localpathutil"
1818
"github.com/lima-vm/lima/pkg/osutil"
19-
"github.com/lima-vm/lima/pkg/qemu/qemuconst"
19+
"github.com/lima-vm/lima/pkg/qemu/const"
2020
"github.com/lima-vm/lima/pkg/sshutil"
2121
"github.com/lima-vm/lima/pkg/store/filenames"
2222
"github.com/opencontainers/go-digest"
@@ -51,9 +51,9 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML) error {
5151
User: u.Username,
5252
UID: uid,
5353
Containerd: Containerd{System: *y.Containerd.System, User: *y.Containerd.User},
54-
SlirpNICName: qemuconst.SlirpNICName,
55-
SlirpGateway: qemuconst.SlirpGateway,
56-
SlirpDNS: qemuconst.SlirpDNS,
54+
SlirpNICName: qemu.SlirpNICName,
55+
SlirpGateway: qemu.SlirpGateway,
56+
SlirpDNS: qemu.SlirpDNS,
5757
Env: y.Env,
5858
}
5959

@@ -77,7 +77,7 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML) error {
7777
}
7878

7979
slirpMACAddress := limayaml.MACAddress(instDir)
80-
args.Networks = append(args.Networks, Network{MACAddress: slirpMACAddress, Interface: qemuconst.SlirpNICName})
80+
args.Networks = append(args.Networks, Network{MACAddress: slirpMACAddress, Interface: qemu.SlirpNICName})
8181
for _, nw := range y.Networks {
8282
args.Networks = append(args.Networks, Network{MACAddress: nw.MACAddress, Interface: nw.Interface})
8383
}

pkg/limayaml/validate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/docker/go-units"
1414
"github.com/lima-vm/lima/pkg/localpathutil"
1515
"github.com/lima-vm/lima/pkg/osutil"
16-
"github.com/lima-vm/lima/pkg/qemu/qemuconst"
16+
"github.com/lima-vm/lima/pkg/qemu/const"
1717
"github.com/sirupsen/logrus"
1818
)
1919

@@ -246,8 +246,8 @@ func validateNetwork(y LimaYAML) error {
246246
if strings.ContainsAny(nw.Interface, " \t\n/") {
247247
return fmt.Errorf("field `%s.interface` must not contain whitespace or slashes", field)
248248
}
249-
if nw.Interface == qemuconst.SlirpNICName {
250-
return fmt.Errorf("field `%s.interface` must not be set to %q because it is reserved for slirp", field, qemuconst.SlirpNICName)
249+
if nw.Interface == qemu.SlirpNICName {
250+
return fmt.Errorf("field `%s.interface` must not be set to %q because it is reserved for slirp", field, qemu.SlirpNICName)
251251
}
252252
if prev, ok := interfaceName[nw.Interface]; ok {
253253
return fmt.Errorf("field `%s.interface` value %q has already been used by field `network.vde[%d].name`", field, nw.Interface, prev)

pkg/qemu/qemuconst/qemuconst.go renamed to pkg/qemu/const/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package qemuconst
1+
package qemu
22

33
const (
44
SlirpNICName = "eth0"

pkg/qemu/qemu.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"github.com/lima-vm/lima/pkg/iso9660util"
1818
"github.com/lima-vm/lima/pkg/limayaml"
1919
"github.com/lima-vm/lima/pkg/networks"
20+
"github.com/lima-vm/lima/pkg/qemu/const"
2021
"github.com/lima-vm/lima/pkg/qemu/imgutil"
21-
"github.com/lima-vm/lima/pkg/qemu/qemuconst"
2222
"github.com/lima-vm/lima/pkg/store/filenames"
2323
"github.com/mattn/go-shellwords"
2424
"github.com/sirupsen/logrus"
@@ -258,7 +258,7 @@ func Cmdline(cfg Config) (string, []string, error) {
258258

259259
// Network
260260
args = append(args, "-netdev", fmt.Sprintf("user,id=net0,net=%s,dhcpstart=%s,hostfwd=tcp:127.0.0.1:%d-:22",
261-
qemuconst.SlirpNetwork, qemuconst.SlirpIPAddress, y.SSH.LocalPort))
261+
qemu.SlirpNetwork, qemu.SlirpIPAddress, y.SSH.LocalPort))
262262
args = append(args, "-device", "virtio-net-pci,netdev=net0,mac="+limayaml.MACAddress(cfg.InstanceDir))
263263
usingVDE := false
264264
for _, nw := range y.Networks {

0 commit comments

Comments
 (0)