@@ -13,14 +13,14 @@ import (
13
13
14
14
"github.com/docker/go-units"
15
15
"github.com/lima-vm/lima/pkg/networks"
16
+ "github.com/lima-vm/lima/pkg/ptr"
16
17
"github.com/pbnjay/memory"
17
18
18
19
"github.com/lima-vm/lima/pkg/guestagent/api"
19
20
"github.com/lima-vm/lima/pkg/osutil"
20
21
"github.com/lima-vm/lima/pkg/store/dirnames"
21
22
"github.com/lima-vm/lima/pkg/store/filenames"
22
23
"github.com/sirupsen/logrus"
23
- "github.com/xorcare/pointer"
24
24
25
25
"golang.org/x/sys/cpu"
26
26
)
@@ -133,21 +133,21 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
133
133
if o .VMType != nil {
134
134
y .VMType = o .VMType
135
135
}
136
- y .VMType = pointer . String (ResolveVMType (y .VMType ))
136
+ y .VMType = ptr . Of (ResolveVMType (y .VMType ))
137
137
if y .OS == nil {
138
138
y .OS = d .OS
139
139
}
140
140
if o .OS != nil {
141
141
y .OS = o .OS
142
142
}
143
- y .OS = pointer . String (ResolveOS (y .OS ))
143
+ y .OS = ptr . Of (ResolveOS (y .OS ))
144
144
if y .Arch == nil {
145
145
y .Arch = d .Arch
146
146
}
147
147
if o .Arch != nil {
148
148
y .Arch = o .Arch
149
149
}
150
- y .Arch = pointer . String (ResolveArch (y .Arch ))
150
+ y .Arch = ptr . Of (ResolveArch (y .Arch ))
151
151
152
152
y .Images = append (append (o .Images , y .Images ... ), d .Images ... )
153
153
for i := range y .Images {
@@ -218,7 +218,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
218
218
y .CPUs = o .CPUs
219
219
}
220
220
if y .CPUs == nil || * y .CPUs == 0 {
221
- y .CPUs = pointer . Int (defaultCPUs ())
221
+ y .CPUs = ptr . Of (defaultCPUs ())
222
222
}
223
223
224
224
if y .Memory == nil {
@@ -228,7 +228,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
228
228
y .Memory = o .Memory
229
229
}
230
230
if y .Memory == nil || * y .Memory == "" {
231
- y .Memory = pointer . String (defaultMemoryAsString ())
231
+ y .Memory = ptr . Of (defaultMemoryAsString ())
232
232
}
233
233
234
234
if y .Disk == nil {
@@ -238,7 +238,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
238
238
y .Disk = o .Disk
239
239
}
240
240
if y .Disk == nil || * y .Disk == "" {
241
- y .Disk = pointer . String (defaultDiskSizeAsString ())
241
+ y .Disk = ptr . Of (defaultDiskSizeAsString ())
242
242
}
243
243
244
244
y .AdditionalDisks = append (append (o .AdditionalDisks , y .AdditionalDisks ... ), d .AdditionalDisks ... )
@@ -250,7 +250,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
250
250
y .Audio .Device = o .Audio .Device
251
251
}
252
252
if y .Audio .Device == nil {
253
- y .Audio .Device = pointer . String ("" )
253
+ y .Audio .Device = ptr . Of ("" )
254
254
}
255
255
256
256
if y .Video .Display == nil {
@@ -260,7 +260,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
260
260
y .Video .Display = o .Video .Display
261
261
}
262
262
if y .Video .Display == nil || * y .Video .Display == "" {
263
- y .Video .Display = pointer . String ("none" )
263
+ y .Video .Display = ptr . Of ("none" )
264
264
}
265
265
266
266
if y .Video .VNC .Display == nil {
@@ -270,7 +270,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
270
270
y .Video .VNC .Display = o .Video .VNC .Display
271
271
}
272
272
if (y .Video .VNC .Display == nil || * y .Video .VNC .Display == "" ) && * y .VMType == QEMU {
273
- y .Video .VNC .Display = pointer . String ("127.0.0.1:0,to=9" )
273
+ y .Video .VNC .Display = ptr . Of ("127.0.0.1:0,to=9" )
274
274
}
275
275
276
276
if y .Firmware .LegacyBIOS == nil {
@@ -280,7 +280,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
280
280
y .Firmware .LegacyBIOS = o .Firmware .LegacyBIOS
281
281
}
282
282
if y .Firmware .LegacyBIOS == nil {
283
- y .Firmware .LegacyBIOS = pointer . Bool (false )
283
+ y .Firmware .LegacyBIOS = ptr . Of (false )
284
284
}
285
285
286
286
if y .SSH .LocalPort == nil {
@@ -291,7 +291,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
291
291
}
292
292
if y .SSH .LocalPort == nil {
293
293
// y.SSH.LocalPort value is not filled here (filled by the hostagent)
294
- y .SSH .LocalPort = pointer . Int (0 )
294
+ y .SSH .LocalPort = ptr . Of (0 )
295
295
}
296
296
if y .SSH .LoadDotSSHPubKeys == nil {
297
297
y .SSH .LoadDotSSHPubKeys = d .SSH .LoadDotSSHPubKeys
@@ -300,7 +300,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
300
300
y .SSH .LoadDotSSHPubKeys = o .SSH .LoadDotSSHPubKeys
301
301
}
302
302
if y .SSH .LoadDotSSHPubKeys == nil {
303
- y .SSH .LoadDotSSHPubKeys = pointer . Bool (true )
303
+ y .SSH .LoadDotSSHPubKeys = ptr . Of (true )
304
304
}
305
305
306
306
if y .SSH .ForwardAgent == nil {
@@ -310,7 +310,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
310
310
y .SSH .ForwardAgent = o .SSH .ForwardAgent
311
311
}
312
312
if y .SSH .ForwardAgent == nil {
313
- y .SSH .ForwardAgent = pointer . Bool (false )
313
+ y .SSH .ForwardAgent = ptr . Of (false )
314
314
}
315
315
316
316
if y .SSH .ForwardX11 == nil {
@@ -320,7 +320,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
320
320
y .SSH .ForwardX11 = o .SSH .ForwardX11
321
321
}
322
322
if y .SSH .ForwardX11 == nil {
323
- y .SSH .ForwardX11 = pointer . Bool (false )
323
+ y .SSH .ForwardX11 = ptr . Of (false )
324
324
}
325
325
326
326
if y .SSH .ForwardX11Trusted == nil {
@@ -330,7 +330,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
330
330
y .SSH .ForwardX11Trusted = o .SSH .ForwardX11Trusted
331
331
}
332
332
if y .SSH .ForwardX11Trusted == nil {
333
- y .SSH .ForwardX11Trusted = pointer . Bool (false )
333
+ y .SSH .ForwardX11Trusted = ptr . Of (false )
334
334
}
335
335
336
336
hosts := make (map [string ]string )
@@ -353,7 +353,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
353
353
provision .Mode = ProvisionModeSystem
354
354
}
355
355
if provision .Mode == ProvisionModeDependency && provision .SkipDefaultDependencyResolution == nil {
356
- provision .SkipDefaultDependencyResolution = pointer . Bool (false )
356
+ provision .SkipDefaultDependencyResolution = ptr . Of (false )
357
357
}
358
358
}
359
359
@@ -364,7 +364,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
364
364
y .GuestInstallPrefix = o .GuestInstallPrefix
365
365
}
366
366
if y .GuestInstallPrefix == nil {
367
- y .GuestInstallPrefix = pointer . String (defaultGuestInstallPrefix ())
367
+ y .GuestInstallPrefix = ptr . Of (defaultGuestInstallPrefix ())
368
368
}
369
369
370
370
if y .Containerd .System == nil {
@@ -374,7 +374,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
374
374
y .Containerd .System = o .Containerd .System
375
375
}
376
376
if y .Containerd .System == nil {
377
- y .Containerd .System = pointer . Bool (false )
377
+ y .Containerd .System = ptr . Of (false )
378
378
}
379
379
if y .Containerd .User == nil {
380
380
y .Containerd .User = d .Containerd .User
@@ -383,7 +383,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
383
383
y .Containerd .User = o .Containerd .User
384
384
}
385
385
if y .Containerd .User == nil {
386
- y .Containerd .User = pointer . Bool (true )
386
+ y .Containerd .User = ptr . Of (true )
387
387
}
388
388
389
389
y .Containerd .Archives = append (append (o .Containerd .Archives , y .Containerd .Archives ... ), d .Containerd .Archives ... )
@@ -427,7 +427,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
427
427
y .HostResolver .Enabled = o .HostResolver .Enabled
428
428
}
429
429
if y .HostResolver .Enabled == nil {
430
- y .HostResolver .Enabled = pointer . Bool (true )
430
+ y .HostResolver .Enabled = ptr . Of (true )
431
431
}
432
432
433
433
if y .HostResolver .IPv6 == nil {
@@ -437,7 +437,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
437
437
y .HostResolver .IPv6 = o .HostResolver .IPv6
438
438
}
439
439
if y .HostResolver .IPv6 == nil {
440
- y .HostResolver .IPv6 = pointer . Bool (false )
440
+ y .HostResolver .IPv6 = ptr . Of (false )
441
441
}
442
442
443
443
if y .PropagateProxyEnv == nil {
@@ -447,7 +447,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
447
447
y .PropagateProxyEnv = o .PropagateProxyEnv
448
448
}
449
449
if y .PropagateProxyEnv == nil {
450
- y .PropagateProxyEnv = pointer . Bool (true )
450
+ y .PropagateProxyEnv = ptr . Of (true )
451
451
}
452
452
453
453
networks := make ([]Network , 0 , len (d .Networks )+ len (y .Networks )+ len (o .Networks ))
@@ -519,9 +519,9 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
519
519
}
520
520
if y .MountType == nil || * y .MountType == "" {
521
521
if * y .VMType == VZ {
522
- y .MountType = pointer . String (VIRTIOFS )
522
+ y .MountType = ptr . Of (VIRTIOFS )
523
523
} else {
524
- y .MountType = pointer . String (REVSSHFS )
524
+ y .MountType = ptr . Of (REVSSHFS )
525
525
}
526
526
}
527
527
@@ -571,34 +571,34 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
571
571
for i := range y .Mounts {
572
572
mount := & y .Mounts [i ]
573
573
if mount .SSHFS .Cache == nil {
574
- mount .SSHFS .Cache = pointer . Bool (true )
574
+ mount .SSHFS .Cache = ptr . Of (true )
575
575
}
576
576
if mount .SSHFS .FollowSymlinks == nil {
577
- mount .SSHFS .FollowSymlinks = pointer . Bool (false )
577
+ mount .SSHFS .FollowSymlinks = ptr . Of (false )
578
578
}
579
579
if mount .SSHFS .SFTPDriver == nil {
580
- mount .SSHFS .SFTPDriver = pointer . String ("" )
580
+ mount .SSHFS .SFTPDriver = ptr . Of ("" )
581
581
}
582
582
if mount .NineP .SecurityModel == nil {
583
- mounts [i ].NineP .SecurityModel = pointer . String (Default9pSecurityModel )
583
+ mounts [i ].NineP .SecurityModel = ptr . Of (Default9pSecurityModel )
584
584
}
585
585
if mount .NineP .ProtocolVersion == nil {
586
- mounts [i ].NineP .ProtocolVersion = pointer . String (Default9pProtocolVersion )
586
+ mounts [i ].NineP .ProtocolVersion = ptr . Of (Default9pProtocolVersion )
587
587
}
588
588
if mount .NineP .Msize == nil {
589
- mounts [i ].NineP .Msize = pointer . String (Default9pMsize )
589
+ mounts [i ].NineP .Msize = ptr . Of (Default9pMsize )
590
590
}
591
591
if mount .Virtiofs .QueueSize == nil && * y .VMType == QEMU && * y .MountType == VIRTIOFS {
592
- mounts [i ].Virtiofs .QueueSize = pointer . Int (DefaultVirtiofsQueueSize )
592
+ mounts [i ].Virtiofs .QueueSize = ptr . Of (DefaultVirtiofsQueueSize )
593
593
}
594
594
if mount .Writable == nil {
595
- mount .Writable = pointer . Bool (false )
595
+ mount .Writable = ptr . Of (false )
596
596
}
597
597
if mount .NineP .Cache == nil {
598
598
if * mount .Writable {
599
- mounts [i ].NineP .Cache = pointer . String (Default9pCacheForRW )
599
+ mounts [i ].NineP .Cache = ptr . Of (Default9pCacheForRW )
600
600
} else {
601
- mounts [i ].NineP .Cache = pointer . String (Default9pCacheForRO )
601
+ mounts [i ].NineP .Cache = ptr . Of (Default9pCacheForRO )
602
602
}
603
603
}
604
604
if mount .MountPoint == "" {
@@ -633,7 +633,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
633
633
y .CACertificates .RemoveDefaults = o .CACertificates .RemoveDefaults
634
634
}
635
635
if y .CACertificates .RemoveDefaults == nil {
636
- y .CACertificates .RemoveDefaults = pointer . Bool (false )
636
+ y .CACertificates .RemoveDefaults = ptr . Of (false )
637
637
}
638
638
639
639
caFiles := unique (append (append (d .CACertificates .Files , y .CACertificates .Files ... ), o .CACertificates .Files ... ))
@@ -650,10 +650,10 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
650
650
y .Rosetta .Enabled = o .Rosetta .Enabled
651
651
}
652
652
if y .Rosetta .Enabled == nil {
653
- y .Rosetta .Enabled = pointer . Bool (false )
653
+ y .Rosetta .Enabled = ptr . Of (false )
654
654
}
655
655
} else {
656
- y .Rosetta .Enabled = pointer . Bool (false )
656
+ y .Rosetta .Enabled = ptr . Of (false )
657
657
}
658
658
659
659
if y .Rosetta .BinFmt == nil {
@@ -663,7 +663,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
663
663
y .Rosetta .BinFmt = o .Rosetta .BinFmt
664
664
}
665
665
if y .Rosetta .BinFmt == nil {
666
- y .Rosetta .BinFmt = pointer . Bool (false )
666
+ y .Rosetta .BinFmt = ptr . Of (false )
667
667
}
668
668
669
669
if y .Plain == nil {
@@ -673,7 +673,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
673
673
y .Plain = o .Plain
674
674
}
675
675
if y .Plain == nil {
676
- y .Plain = pointer . Bool (false )
676
+ y .Plain = ptr . Of (false )
677
677
}
678
678
679
679
fixUpForPlainMode (y )
@@ -685,10 +685,10 @@ func fixUpForPlainMode(y *LimaYAML) {
685
685
}
686
686
y .Mounts = nil
687
687
y .PortForwards = nil
688
- y .Containerd .System = pointer . Bool (false )
689
- y .Containerd .User = pointer . Bool (false )
690
- y .Rosetta .BinFmt = pointer . Bool (false )
691
- y .Rosetta .Enabled = pointer . Bool (false )
688
+ y .Containerd .System = ptr . Of (false )
689
+ y .Containerd .User = ptr . Of (false )
690
+ y .Rosetta .BinFmt = ptr . Of (false )
691
+ y .Rosetta .Enabled = ptr . Of (false )
692
692
}
693
693
694
694
func executeGuestTemplate (format string ) (bytes.Buffer , error ) {
0 commit comments