@@ -13,14 +13,14 @@ import (
1313
1414 "github.com/docker/go-units"
1515 "github.com/lima-vm/lima/pkg/networks"
16+ "github.com/lima-vm/lima/pkg/ptr"
1617 "github.com/pbnjay/memory"
1718
1819 "github.com/lima-vm/lima/pkg/guestagent/api"
1920 "github.com/lima-vm/lima/pkg/osutil"
2021 "github.com/lima-vm/lima/pkg/store/dirnames"
2122 "github.com/lima-vm/lima/pkg/store/filenames"
2223 "github.com/sirupsen/logrus"
23- "github.com/xorcare/pointer"
2424
2525 "golang.org/x/sys/cpu"
2626)
@@ -133,21 +133,21 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
133133 if o .VMType != nil {
134134 y .VMType = o .VMType
135135 }
136- y .VMType = pointer . String (ResolveVMType (y .VMType ))
136+ y .VMType = ptr . Of (ResolveVMType (y .VMType ))
137137 if y .OS == nil {
138138 y .OS = d .OS
139139 }
140140 if o .OS != nil {
141141 y .OS = o .OS
142142 }
143- y .OS = pointer . String (ResolveOS (y .OS ))
143+ y .OS = ptr . Of (ResolveOS (y .OS ))
144144 if y .Arch == nil {
145145 y .Arch = d .Arch
146146 }
147147 if o .Arch != nil {
148148 y .Arch = o .Arch
149149 }
150- y .Arch = pointer . String (ResolveArch (y .Arch ))
150+ y .Arch = ptr . Of (ResolveArch (y .Arch ))
151151
152152 y .Images = append (append (o .Images , y .Images ... ), d .Images ... )
153153 for i := range y .Images {
@@ -218,7 +218,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
218218 y .CPUs = o .CPUs
219219 }
220220 if y .CPUs == nil || * y .CPUs == 0 {
221- y .CPUs = pointer . Int (defaultCPUs ())
221+ y .CPUs = ptr . Of (defaultCPUs ())
222222 }
223223
224224 if y .Memory == nil {
@@ -228,7 +228,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
228228 y .Memory = o .Memory
229229 }
230230 if y .Memory == nil || * y .Memory == "" {
231- y .Memory = pointer . String (defaultMemoryAsString ())
231+ y .Memory = ptr . Of (defaultMemoryAsString ())
232232 }
233233
234234 if y .Disk == nil {
@@ -238,7 +238,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
238238 y .Disk = o .Disk
239239 }
240240 if y .Disk == nil || * y .Disk == "" {
241- y .Disk = pointer . String (defaultDiskSizeAsString ())
241+ y .Disk = ptr . Of (defaultDiskSizeAsString ())
242242 }
243243
244244 y .AdditionalDisks = append (append (o .AdditionalDisks , y .AdditionalDisks ... ), d .AdditionalDisks ... )
@@ -250,7 +250,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
250250 y .Audio .Device = o .Audio .Device
251251 }
252252 if y .Audio .Device == nil {
253- y .Audio .Device = pointer . String ("" )
253+ y .Audio .Device = ptr . Of ("" )
254254 }
255255
256256 if y .Video .Display == nil {
@@ -260,7 +260,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
260260 y .Video .Display = o .Video .Display
261261 }
262262 if y .Video .Display == nil || * y .Video .Display == "" {
263- y .Video .Display = pointer . String ("none" )
263+ y .Video .Display = ptr . Of ("none" )
264264 }
265265
266266 if y .Video .VNC .Display == nil {
@@ -270,7 +270,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
270270 y .Video .VNC .Display = o .Video .VNC .Display
271271 }
272272 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" )
274274 }
275275
276276 if y .Firmware .LegacyBIOS == nil {
@@ -280,7 +280,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
280280 y .Firmware .LegacyBIOS = o .Firmware .LegacyBIOS
281281 }
282282 if y .Firmware .LegacyBIOS == nil {
283- y .Firmware .LegacyBIOS = pointer . Bool (false )
283+ y .Firmware .LegacyBIOS = ptr . Of (false )
284284 }
285285
286286 if y .SSH .LocalPort == nil {
@@ -291,7 +291,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
291291 }
292292 if y .SSH .LocalPort == nil {
293293 // 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 )
295295 }
296296 if y .SSH .LoadDotSSHPubKeys == nil {
297297 y .SSH .LoadDotSSHPubKeys = d .SSH .LoadDotSSHPubKeys
@@ -300,7 +300,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
300300 y .SSH .LoadDotSSHPubKeys = o .SSH .LoadDotSSHPubKeys
301301 }
302302 if y .SSH .LoadDotSSHPubKeys == nil {
303- y .SSH .LoadDotSSHPubKeys = pointer . Bool (true )
303+ y .SSH .LoadDotSSHPubKeys = ptr . Of (true )
304304 }
305305
306306 if y .SSH .ForwardAgent == nil {
@@ -310,7 +310,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
310310 y .SSH .ForwardAgent = o .SSH .ForwardAgent
311311 }
312312 if y .SSH .ForwardAgent == nil {
313- y .SSH .ForwardAgent = pointer . Bool (false )
313+ y .SSH .ForwardAgent = ptr . Of (false )
314314 }
315315
316316 if y .SSH .ForwardX11 == nil {
@@ -320,7 +320,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
320320 y .SSH .ForwardX11 = o .SSH .ForwardX11
321321 }
322322 if y .SSH .ForwardX11 == nil {
323- y .SSH .ForwardX11 = pointer . Bool (false )
323+ y .SSH .ForwardX11 = ptr . Of (false )
324324 }
325325
326326 if y .SSH .ForwardX11Trusted == nil {
@@ -330,7 +330,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
330330 y .SSH .ForwardX11Trusted = o .SSH .ForwardX11Trusted
331331 }
332332 if y .SSH .ForwardX11Trusted == nil {
333- y .SSH .ForwardX11Trusted = pointer . Bool (false )
333+ y .SSH .ForwardX11Trusted = ptr . Of (false )
334334 }
335335
336336 hosts := make (map [string ]string )
@@ -353,7 +353,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
353353 provision .Mode = ProvisionModeSystem
354354 }
355355 if provision .Mode == ProvisionModeDependency && provision .SkipDefaultDependencyResolution == nil {
356- provision .SkipDefaultDependencyResolution = pointer . Bool (false )
356+ provision .SkipDefaultDependencyResolution = ptr . Of (false )
357357 }
358358 }
359359
@@ -364,7 +364,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
364364 y .GuestInstallPrefix = o .GuestInstallPrefix
365365 }
366366 if y .GuestInstallPrefix == nil {
367- y .GuestInstallPrefix = pointer . String (defaultGuestInstallPrefix ())
367+ y .GuestInstallPrefix = ptr . Of (defaultGuestInstallPrefix ())
368368 }
369369
370370 if y .Containerd .System == nil {
@@ -374,7 +374,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
374374 y .Containerd .System = o .Containerd .System
375375 }
376376 if y .Containerd .System == nil {
377- y .Containerd .System = pointer . Bool (false )
377+ y .Containerd .System = ptr . Of (false )
378378 }
379379 if y .Containerd .User == nil {
380380 y .Containerd .User = d .Containerd .User
@@ -383,7 +383,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
383383 y .Containerd .User = o .Containerd .User
384384 }
385385 if y .Containerd .User == nil {
386- y .Containerd .User = pointer . Bool (true )
386+ y .Containerd .User = ptr . Of (true )
387387 }
388388
389389 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) {
427427 y .HostResolver .Enabled = o .HostResolver .Enabled
428428 }
429429 if y .HostResolver .Enabled == nil {
430- y .HostResolver .Enabled = pointer . Bool (true )
430+ y .HostResolver .Enabled = ptr . Of (true )
431431 }
432432
433433 if y .HostResolver .IPv6 == nil {
@@ -437,7 +437,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
437437 y .HostResolver .IPv6 = o .HostResolver .IPv6
438438 }
439439 if y .HostResolver .IPv6 == nil {
440- y .HostResolver .IPv6 = pointer . Bool (false )
440+ y .HostResolver .IPv6 = ptr . Of (false )
441441 }
442442
443443 if y .PropagateProxyEnv == nil {
@@ -447,7 +447,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
447447 y .PropagateProxyEnv = o .PropagateProxyEnv
448448 }
449449 if y .PropagateProxyEnv == nil {
450- y .PropagateProxyEnv = pointer . Bool (true )
450+ y .PropagateProxyEnv = ptr . Of (true )
451451 }
452452
453453 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) {
519519 }
520520 if y .MountType == nil || * y .MountType == "" {
521521 if * y .VMType == VZ {
522- y .MountType = pointer . String (VIRTIOFS )
522+ y .MountType = ptr . Of (VIRTIOFS )
523523 } else {
524- y .MountType = pointer . String (REVSSHFS )
524+ y .MountType = ptr . Of (REVSSHFS )
525525 }
526526 }
527527
@@ -571,34 +571,34 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
571571 for i := range y .Mounts {
572572 mount := & y .Mounts [i ]
573573 if mount .SSHFS .Cache == nil {
574- mount .SSHFS .Cache = pointer . Bool (true )
574+ mount .SSHFS .Cache = ptr . Of (true )
575575 }
576576 if mount .SSHFS .FollowSymlinks == nil {
577- mount .SSHFS .FollowSymlinks = pointer . Bool (false )
577+ mount .SSHFS .FollowSymlinks = ptr . Of (false )
578578 }
579579 if mount .SSHFS .SFTPDriver == nil {
580- mount .SSHFS .SFTPDriver = pointer . String ("" )
580+ mount .SSHFS .SFTPDriver = ptr . Of ("" )
581581 }
582582 if mount .NineP .SecurityModel == nil {
583- mounts [i ].NineP .SecurityModel = pointer . String (Default9pSecurityModel )
583+ mounts [i ].NineP .SecurityModel = ptr . Of (Default9pSecurityModel )
584584 }
585585 if mount .NineP .ProtocolVersion == nil {
586- mounts [i ].NineP .ProtocolVersion = pointer . String (Default9pProtocolVersion )
586+ mounts [i ].NineP .ProtocolVersion = ptr . Of (Default9pProtocolVersion )
587587 }
588588 if mount .NineP .Msize == nil {
589- mounts [i ].NineP .Msize = pointer . String (Default9pMsize )
589+ mounts [i ].NineP .Msize = ptr . Of (Default9pMsize )
590590 }
591591 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 )
593593 }
594594 if mount .Writable == nil {
595- mount .Writable = pointer . Bool (false )
595+ mount .Writable = ptr . Of (false )
596596 }
597597 if mount .NineP .Cache == nil {
598598 if * mount .Writable {
599- mounts [i ].NineP .Cache = pointer . String (Default9pCacheForRW )
599+ mounts [i ].NineP .Cache = ptr . Of (Default9pCacheForRW )
600600 } else {
601- mounts [i ].NineP .Cache = pointer . String (Default9pCacheForRO )
601+ mounts [i ].NineP .Cache = ptr . Of (Default9pCacheForRO )
602602 }
603603 }
604604 if mount .MountPoint == "" {
@@ -633,7 +633,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
633633 y .CACertificates .RemoveDefaults = o .CACertificates .RemoveDefaults
634634 }
635635 if y .CACertificates .RemoveDefaults == nil {
636- y .CACertificates .RemoveDefaults = pointer . Bool (false )
636+ y .CACertificates .RemoveDefaults = ptr . Of (false )
637637 }
638638
639639 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) {
650650 y .Rosetta .Enabled = o .Rosetta .Enabled
651651 }
652652 if y .Rosetta .Enabled == nil {
653- y .Rosetta .Enabled = pointer . Bool (false )
653+ y .Rosetta .Enabled = ptr . Of (false )
654654 }
655655 } else {
656- y .Rosetta .Enabled = pointer . Bool (false )
656+ y .Rosetta .Enabled = ptr . Of (false )
657657 }
658658
659659 if y .Rosetta .BinFmt == nil {
@@ -663,7 +663,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
663663 y .Rosetta .BinFmt = o .Rosetta .BinFmt
664664 }
665665 if y .Rosetta .BinFmt == nil {
666- y .Rosetta .BinFmt = pointer . Bool (false )
666+ y .Rosetta .BinFmt = ptr . Of (false )
667667 }
668668
669669 if y .Plain == nil {
@@ -673,7 +673,7 @@ func FillDefault(y, d, o *LimaYAML, filePath string) {
673673 y .Plain = o .Plain
674674 }
675675 if y .Plain == nil {
676- y .Plain = pointer . Bool (false )
676+ y .Plain = ptr . Of (false )
677677 }
678678
679679 fixUpForPlainMode (y )
@@ -685,10 +685,10 @@ func fixUpForPlainMode(y *LimaYAML) {
685685 }
686686 y .Mounts = nil
687687 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 )
692692}
693693
694694func executeGuestTemplate (format string ) (bytes.Buffer , error ) {
0 commit comments