summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-13 06:42:56 -0500
committerGitHub <noreply@github.com>2021-02-13 06:42:56 -0500
commit3ba0afdd0f03195827f46b50757928ead44b1567 (patch)
tree9d2cadfe791ebd5a326cc521560b644f586c575e /pkg/specgen/generate
parent9d57aa75a5f22296b81cd37abe08660001971c4a (diff)
parent78b419909bdf1eeb4af17fff471b381de91bcf73 (diff)
downloadpodman-3ba0afdd0f03195827f46b50757928ead44b1567.tar.gz
podman-3ba0afdd0f03195827f46b50757928ead44b1567.tar.bz2
podman-3ba0afdd0f03195827f46b50757928ead44b1567.zip
Merge pull request #9342 from Luap99/lint
Enable more golangci-lint linters
Diffstat (limited to 'pkg/specgen/generate')
-rw-r--r--pkg/specgen/generate/config_linux.go1
-rw-r--r--pkg/specgen/generate/kube/kube.go1
-rw-r--r--pkg/specgen/generate/kube/seccomp.go1
-rw-r--r--pkg/specgen/generate/kube/volume.go2
-rw-r--r--pkg/specgen/generate/oci.go1
-rw-r--r--pkg/specgen/generate/security.go14
6 files changed, 8 insertions, 12 deletions
diff --git a/pkg/specgen/generate/config_linux.go b/pkg/specgen/generate/config_linux.go
index 1290a8eb6..b9f024814 100644
--- a/pkg/specgen/generate/config_linux.go
+++ b/pkg/specgen/generate/config_linux.go
@@ -113,7 +113,6 @@ func DevicesFromPath(g *generate.Generator, devicePath string) error {
// mount the internal devices recursively
if err := filepath.Walk(resolvedDevicePath, func(dpath string, f os.FileInfo, e error) error {
-
if f.Mode()&os.ModeDevice == os.ModeDevice {
found = true
device := fmt.Sprintf("%s:%s", dpath, filepath.Join(dest, strings.TrimPrefix(dpath, src)))
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 98ab82259..e04ced3d3 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -384,7 +384,6 @@ func getPodPorts(containers []v1.Container) []specgen.PortMapping {
if p.HostPort != 0 {
infraPorts = append(infraPorts, portBinding)
}
-
}
}
return infraPorts
diff --git a/pkg/specgen/generate/kube/seccomp.go b/pkg/specgen/generate/kube/seccomp.go
index 4cbdf6e2e..353f9cbf2 100644
--- a/pkg/specgen/generate/kube/seccomp.go
+++ b/pkg/specgen/generate/kube/seccomp.go
@@ -11,6 +11,7 @@ import (
// KubeSeccompPaths holds information about a pod YAML's seccomp configuration
// it holds both container and pod seccomp paths
+// nolint:golint
type KubeSeccompPaths struct {
containerPaths map[string]string
podPath string
diff --git a/pkg/specgen/generate/kube/volume.go b/pkg/specgen/generate/kube/volume.go
index f5687f60d..c3241a49e 100644
--- a/pkg/specgen/generate/kube/volume.go
+++ b/pkg/specgen/generate/kube/volume.go
@@ -17,6 +17,7 @@ const (
kubeFilePermission = 0644
)
+// nolint:golint
type KubeVolumeType int
const (
@@ -24,6 +25,7 @@ const (
KubeVolumeTypeNamed KubeVolumeType = iota
)
+// nolint:golint
type KubeVolume struct {
// Type of volume to create
Type KubeVolumeType
diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go
index e62131244..1a0ec08a5 100644
--- a/pkg/specgen/generate/oci.go
+++ b/pkg/specgen/generate/oci.go
@@ -219,7 +219,6 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt
if !mappingFound {
gid5Available = false
}
-
}
if !gid5Available {
// If we have no GID mappings, the gid=5 default option would fail, so drop it.
diff --git a/pkg/specgen/generate/security.go b/pkg/specgen/generate/security.go
index 390b19beb..fb45d87db 100644
--- a/pkg/specgen/generate/security.go
+++ b/pkg/specgen/generate/security.go
@@ -109,17 +109,15 @@ func securityConfigureGenerator(s *specgen.SpecGenerator, g *generate.Generator,
}
}
if !s.Privileged && len(capsRequiredRequested) > 0 {
-
// Pass capRequiredRequested in CapAdd field to normalize capabilities names
capsRequired, err := capabilities.MergeCapabilities(nil, capsRequiredRequested, nil)
if err != nil {
return errors.Wrapf(err, "capabilities requested by user or image are not valid: %q", strings.Join(capsRequired, ","))
- } else {
- // Verify all capRequired are in the capList
- for _, cap := range capsRequired {
- if !util.StringInSlice(cap, caplist) {
- privCapsRequired = append(privCapsRequired, cap)
- }
+ }
+ // Verify all capRequired are in the capList
+ for _, cap := range capsRequired {
+ if !util.StringInSlice(cap, caplist) {
+ privCapsRequired = append(privCapsRequired, cap)
}
}
if len(privCapsRequired) == 0 {
@@ -189,7 +187,6 @@ func securityConfigureGenerator(s *specgen.SpecGenerator, g *generate.Generator,
return err
}
for sysctlKey, sysctlVal := range defaultSysctls {
-
// Ignore mqueue sysctls if --ipc=host
if noUseIPC && strings.HasPrefix(sysctlKey, "fs.mqueue.") {
logrus.Infof("Sysctl %s=%s ignored in containers.conf, since IPC Namespace set to host", sysctlKey, sysctlVal)
@@ -213,7 +210,6 @@ func securityConfigureGenerator(s *specgen.SpecGenerator, g *generate.Generator,
}
for sysctlKey, sysctlVal := range s.Sysctl {
-
if s.IpcNS.IsHost() && strings.HasPrefix(sysctlKey, "fs.mqueue.") {
return errors.Wrapf(define.ErrInvalidArg, "sysctl %s=%s can't be set since IPC Namespace set to host", sysctlKey, sysctlVal)
}