mirror of https://github.com/containers/podman.git
Enable lint for Darwin and fix identified issues
[NO NEW TESTS NEEDED] Just fixing lint issues Signed-off-by: Matt Heon <mheon@redhat.com>
This commit is contained in:
parent
e99ececc2f
commit
19b676f855
|
@ -338,7 +338,7 @@ osx_alt_build_task:
|
||||||
# The previous task may have been canceled or aborted.
|
# The previous task may have been canceled or aborted.
|
||||||
prep_script: &mac_cleanup "contrib/cirrus/mac_cleanup.sh"
|
prep_script: &mac_cleanup "contrib/cirrus/mac_cleanup.sh"
|
||||||
lint_script:
|
lint_script:
|
||||||
- make lint || true # TODO: Enable when code passes check
|
- make golangci-lint
|
||||||
basic_build_script:
|
basic_build_script:
|
||||||
- make .install.ginkgo
|
- make .install.ginkgo
|
||||||
- make podman-remote
|
- make podman-remote
|
||||||
|
|
|
@ -18,8 +18,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
rwx_rx_rx = 0755
|
mode755 = 0755
|
||||||
rw_r_r = 0644
|
mode644 = 0644
|
||||||
)
|
)
|
||||||
|
|
||||||
const launchConfig = `<?xml version="1.0" encoding="UTF-8"?>
|
const launchConfig = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
@ -109,7 +109,7 @@ func install(cmd *cobra.Command, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_EXCL, rw_r_r)
|
file, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_EXCL, mode644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating helper plist file: %w", err)
|
return fmt.Errorf("creating helper plist file: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ func restrictRecursive(targetDir string, until string) error {
|
||||||
if err = os.Chown(targetDir, 0, 0); err != nil {
|
if err = os.Chown(targetDir, 0, 0); err != nil {
|
||||||
return fmt.Errorf("could not update ownership of helper path: %w", err)
|
return fmt.Errorf("could not update ownership of helper path: %w", err)
|
||||||
}
|
}
|
||||||
if err = os.Chmod(targetDir, rwx_rx_rx|fs.ModeSticky); err != nil {
|
if err = os.Chmod(targetDir, mode755|fs.ModeSticky); err != nil {
|
||||||
return fmt.Errorf("could not update permissions of helper path: %w", err)
|
return fmt.Errorf("could not update permissions of helper path: %w", err)
|
||||||
}
|
}
|
||||||
targetDir = filepath.Dir(targetDir)
|
targetDir = filepath.Dir(targetDir)
|
||||||
|
@ -205,7 +205,7 @@ func installExecutable(user string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
targetDir := filepath.Join(installPrefix, "podman", "helper", user)
|
targetDir := filepath.Join(installPrefix, "podman", "helper", user)
|
||||||
if err := os.MkdirAll(targetDir, rwx_rx_rx); err != nil {
|
if err := os.MkdirAll(targetDir, mode755); err != nil {
|
||||||
return "", fmt.Errorf("could not create helper directory structure: %w", err)
|
return "", fmt.Errorf("could not create helper directory structure: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ func installExecutable(user string) (string, error) {
|
||||||
}
|
}
|
||||||
install := filepath.Join(targetDir, filepath.Base(exec))
|
install := filepath.Join(targetDir, filepath.Base(exec))
|
||||||
|
|
||||||
return install, copyFile(install, exec, rwx_rx_rx)
|
return install, copyFile(install, exec, mode755)
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyFile(dest string, source string, perms fs.FileMode) error {
|
func copyFile(dest string, source string, perms fs.FileMode) error {
|
||||||
|
|
|
@ -72,7 +72,7 @@ func getUserInfo(name string) (string, string, string, error) {
|
||||||
entry := readCapped(output)
|
entry := readCapped(output)
|
||||||
elements := strings.Split(entry, ":")
|
elements := strings.Split(entry, ":")
|
||||||
if len(elements) < 9 || elements[0] != name {
|
if len(elements) < 9 || elements[0] != name {
|
||||||
return "", "", "", errors.New("Could not look up user")
|
return "", "", "", errors.New("could not look up user")
|
||||||
}
|
}
|
||||||
|
|
||||||
return elements[0], elements[2], elements[8], nil
|
return elements[0], elements[2], elements[8], nil
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"io/fs"
|
|
||||||
"errors"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -67,7 +67,7 @@ func uninstall(cmd *cobra.Command, args []string) error {
|
||||||
return fmt.Errorf("could not stat dockerSock: %v", err)
|
return fmt.Errorf("could not stat dockerSock: %v", err)
|
||||||
}
|
}
|
||||||
if target, err := os.Readlink(dockerSock); err != nil {
|
if target, err := os.Readlink(dockerSock); err != nil {
|
||||||
//Return an error if unable to read the symlink
|
// Return an error if unable to read the symlink
|
||||||
return fmt.Errorf("could not read dockerSock symlink: %v", err)
|
return fmt.Errorf("could not read dockerSock symlink: %v", err)
|
||||||
} else {
|
} else {
|
||||||
// Check if the target of the symlink matches the expected target
|
// Check if the target of the symlink matches the expected target
|
||||||
|
|
|
@ -107,7 +107,7 @@ func generateSystemDFilesForVirtiofsMounts(mounts []machine.VirtIoFs) []ignition
|
||||||
// for automatic mounting on boot, and a "preparatory" service file that disables FCOS security, performs
|
// for automatic mounting on boot, and a "preparatory" service file that disables FCOS security, performs
|
||||||
// the mkdir of the mount point, and then re-enables security. This must be done for each mount.
|
// the mkdir of the mount point, and then re-enables security. This must be done for each mount.
|
||||||
|
|
||||||
var unitFiles []ignition.Unit
|
unitFiles := make([]ignition.Unit, 0, len(mounts))
|
||||||
for _, mnt := range mounts {
|
for _, mnt := range mounts {
|
||||||
// Here we are looping the mounts and for each mount, we are adding two unit files
|
// Here we are looping the mounts and for each mount, we are adding two unit files
|
||||||
// for virtiofs. One unit file is the mount itself and the second is to automount it
|
// for virtiofs. One unit file is the mount itself and the second is to automount it
|
||||||
|
|
|
@ -63,7 +63,7 @@ func (a AppleHVStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.Machine
|
||||||
}
|
}
|
||||||
mc.AppleHypervisor.Vfkit.Endpoint = localhostURI + ":" + strconv.Itoa(randPort)
|
mc.AppleHypervisor.Vfkit.Endpoint = localhostURI + ":" + strconv.Itoa(randPort)
|
||||||
|
|
||||||
var virtiofsMounts []machine.VirtIoFs
|
virtiofsMounts := make([]machine.VirtIoFs, 0, len(mc.Mounts))
|
||||||
for _, mnt := range mc.Mounts {
|
for _, mnt := range mc.Mounts {
|
||||||
virtiofsMounts = append(virtiofsMounts, machine.MountToVirtIOFs(mnt))
|
virtiofsMounts = append(virtiofsMounts, machine.MountToVirtIOFs(mnt))
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ func getIgnitionVsockDevice(path string) (vfConfig.VirtioDevice, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func virtIOFsToVFKitVirtIODevice(mounts []*vmconfigs.Mount) ([]vfConfig.VirtioDevice, error) {
|
func virtIOFsToVFKitVirtIODevice(mounts []*vmconfigs.Mount) ([]vfConfig.VirtioDevice, error) {
|
||||||
var virtioDevices []vfConfig.VirtioDevice
|
virtioDevices := make([]vfConfig.VirtioDevice, 0, len(mounts))
|
||||||
for _, vol := range mounts {
|
for _, vol := range mounts {
|
||||||
virtfsDevice, err := vfConfig.VirtioFsNew(vol.Source, vol.Tag)
|
virtfsDevice, err := vfConfig.VirtioFsNew(vol.Source, vol.Tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -83,7 +83,8 @@ func (vf *VfkitHelper) stateChange(newState rest.StateChange) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
payload := bytes.NewReader(b)
|
payload := bytes.NewReader(b)
|
||||||
_, err = vf.post(vf.Endpoint+state, payload)
|
serverResponse, err := vf.post(vf.Endpoint+state, payload)
|
||||||
|
_ = serverResponse.Body.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue