Merge pull request #28585 from jaitjacob/gofix/pkg-machine

cleanup: run go fix on pkg/machine for windows
This commit is contained in:
Jan Rodák 2026-04-29 14:09:11 +02:00 committed by GitHub
commit 2be2e05d7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 9 deletions

View file

@ -174,7 +174,7 @@ var _ = Describe("podman machine init - windows only", func() {
newFileServerVsocks, err := vsock.LoadAllHVSockRegistryEntriesByPurpose(vsock.Fileserver)
Expect(err).ToNot(HaveOccurred())
Expect(newFileServerVsocks).To(HaveLen(countFileServerVsocks))
for i := 0; i < countFileServerVsocks; i++ {
for i := range countFileServerVsocks {
Expect(newFileServerVsocks[i].Port).To(Equal(fileServerVsocks[i].Port))
}

View file

@ -174,7 +174,7 @@ func (hv *HVSockRegistryEntry) exists() (bool, error) {
// already being used by another hvsock in the Windows registry.
func findOpenHVSockPort() (uint64, error) {
// If we cannot find a free port in 10 attempts, something is wrong
for i := 0; i < 10; i++ {
for range 10 {
port, err := utils.GetRandomPort()
if err != nil {
return 0, err

View file

@ -82,7 +82,7 @@ func PipeNameAvailable(pipeName string, maxWait time.Duration) bool {
func WaitPipeExists(pipeName string, retries int, checkFailure func() error) error {
var err error
for i := 0; i < retries; i++ {
for range retries {
err = fileutils.Exists(`\\.\pipe\` + pipeName)
if err == nil {
break

View file

@ -210,12 +210,7 @@ func wrapMaybef(err error, format string, args ...any) error {
// IsReExecuting checks if the current process was re-executed with --reexec flag
func IsReExecuting() bool {
for _, arg := range os.Args {
if arg == "--reexec" {
return true
}
}
return false
return slices.Contains(os.Args, "--reexec")
}
func CreateOrTruncateElevatedOutputFile() error {