diff options
author | Valentin Rothberg <vrothberg@redhat.com> | 2022-03-21 15:47:01 +0100 |
---|---|---|
committer | Valentin Rothberg <vrothberg@redhat.com> | 2022-03-22 13:15:28 +0100 |
commit | 06dd9136a253521cb74497a59f2e6894806a5b6d (patch) | |
tree | d6728a4ffd1d15b5abe415b5574bfdab14eb7fea /pkg/machine | |
parent | 6c030cd5737a6257e9b7ee2db232a24ccef294de (diff) | |
download | podman-06dd9136a253521cb74497a59f2e6894806a5b6d.tar.gz podman-06dd9136a253521cb74497a59f2e6894806a5b6d.tar.bz2 podman-06dd9136a253521cb74497a59f2e6894806a5b6d.zip |
fix a number of errcheck issues
Numerous issues remain, especially in tests/e2e.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'pkg/machine')
-rw-r--r-- | pkg/machine/fedora.go | 2 | ||||
-rw-r--r-- | pkg/machine/qemu/machine.go | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/pkg/machine/fedora.go b/pkg/machine/fedora.go index bcf694def..bed45c6da 100644 --- a/pkg/machine/fedora.go +++ b/pkg/machine/fedora.go @@ -59,7 +59,7 @@ func (f FedoraDownload) Get() *Download { func (f FedoraDownload) HasUsableCache() (bool, error) { info, err := os.Stat(f.LocalPath) if err != nil { - if os.IsNotExist(err) { + if errors.Is(err, os.ErrNotExist) { return false, nil } return false, err diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index c9fe9e8d1..1bd9fb51b 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -278,7 +278,9 @@ func (v *MachineVM) Init(opts machine.InitOptions) (bool, error) { fmt.Println("An ignition path was provided. No SSH connection was added to Podman") } // Write the JSON file - v.writeConfig() + if err := v.writeConfig(); err != nil { + return false, fmt.Errorf("writing JSON file: %w", err) + } // User has provided ignition file so keygen // will be skipped. @@ -1099,10 +1101,13 @@ func waitAndPingAPI(sock string) { Transport: &http.Transport{ DialContext: func(context.Context, string, string) (net.Conn, error) { con, err := net.DialTimeout("unix", sock, apiUpTimeout) - if err == nil { - con.SetDeadline(time.Now().Add(apiUpTimeout)) + if err != nil { + return nil, err + } + if err := con.SetDeadline(time.Now().Add(apiUpTimeout)); err != nil { + return nil, err } - return con, err + return con, nil }, }, } |