summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.golangci.yml1
-rw-r--r--Makefile2
-rw-r--r--cmd/podman/containers/create.go6
-rw-r--r--cmd/podman/volumes/unmount.go1
-rw-r--r--libpod/container_inspect.go2
-rw-r--r--libpod/container_internal_linux.go7
-rw-r--r--libpod/healthcheck_linux.go2
-rw-r--r--libpod/options.go3
-rw-r--r--libpod/runtime_ctr.go4
-rw-r--r--pkg/api/handlers/libpod/manifests.go4
-rw-r--r--pkg/api/server/register_manifest.go3
-rw-r--r--pkg/bindings/test/images_test.go18
-rw-r--r--pkg/bindings/test/secrets_test.go2
-rw-r--r--pkg/domain/infra/tunnel/pods.go4
-rw-r--r--pkg/machine/fcos.go4
-rw-r--r--pkg/specgen/generate/kube/kube.go6
-rw-r--r--pkg/systemd/dbus.go3
-rw-r--r--test/e2e/checkpoint_test.go2
-rw-r--r--test/e2e/common_test.go4
-rw-r--r--test/e2e/login_logout_test.go2
-rw-r--r--test/e2e/push_test.go1
-rw-r--r--test/e2e/systemd_activate_test.go2
-rw-r--r--test/utils/common_function_test.go3
-rw-r--r--test/utils/utils.go2
-rw-r--r--test/version/main.go2
-rw-r--r--utils/utils_supported.go7
26 files changed, 56 insertions, 41 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 956e528ef..8a922775a 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -32,7 +32,6 @@ linters:
- predeclared
- thelper
- ifshort
- - staticcheck
- forbidigo
- exhaustive
- unparam
diff --git a/Makefile b/Makefile
index e94d4cf73..502323906 100644
--- a/Makefile
+++ b/Makefile
@@ -877,7 +877,7 @@ install.tools: .install.goimports .install.gitvalidation .install.md2man .instal
.PHONY: .install.golangci-lint
.install.golangci-lint: .gopathok
- VERSION=1.45.0 GOBIN=$(GOBIN) ./hack/install_golangci.sh
+ VERSION=1.45.2 GOBIN=$(GOBIN) ./hack/install_golangci.sh
.PHONY: .install.bats
.install.bats: .gopathok
diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go
index bbc449a1e..b202e404f 100644
--- a/cmd/podman/containers/create.go
+++ b/cmd/podman/containers/create.go
@@ -286,8 +286,6 @@ func CreateInit(c *cobra.Command, vals entities.ContainerCreateOptions, isInfra
if !isInfra && c.Flag("entrypoint").Changed {
val := c.Flag("entrypoint").Value.String()
vals.Entrypoint = &val
- } else if isInfra && c.Flag("infra-command").Changed {
-
}
// Docker-compatibility: the "-h" flag for run/create is reserved for
@@ -297,7 +295,7 @@ func CreateInit(c *cobra.Command, vals entities.ContainerCreateOptions, isInfra
}
func PullImage(imageName string, cliVals entities.ContainerCreateOptions) (string, error) {
- pullPolicy, err := config.ValidatePullPolicy(cliVals.Pull)
+ pullPolicy, err := config.ParsePullPolicy(cliVals.Pull)
if err != nil {
return "", err
}
@@ -383,7 +381,7 @@ func createPodIfNecessary(cmd *cobra.Command, s *specgen.SpecGenerator, netOpts
podSpec := entities.PodSpec{}
podGen := specgen.NewPodSpecGenerator()
podSpec.PodSpecGen = *podGen
- podGen, err = entities.ToPodSpecGen(*&podSpec.PodSpecGen, &createOptions)
+ podGen, err = entities.ToPodSpecGen(podSpec.PodSpecGen, &createOptions)
if err != nil {
return nil, err
}
diff --git a/cmd/podman/volumes/unmount.go b/cmd/podman/volumes/unmount.go
index dd0cebc06..af79e49ef 100644
--- a/cmd/podman/volumes/unmount.go
+++ b/cmd/podman/volumes/unmount.go
@@ -37,7 +37,6 @@ func volumeUnmount(cmd *cobra.Command, args []string) error {
return err
}
for _, r := range reports {
- var errs utils.OutputErrors
if r.Err == nil {
fmt.Println(r.Id)
} else {
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index 735790411..76e0e9e13 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -845,7 +845,7 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named
// Do not include if privileged - assumed that all devices will be
// included.
var err error
- hostConfig.Devices, err = c.GetDevices(*&hostConfig.Privileged, *ctrSpec, deviceNodes)
+ hostConfig.Devices, err = c.GetDevices(hostConfig.Privileged, *ctrSpec, deviceNodes)
if err != nil {
return nil, err
}
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index f8d0a124c..6ffd99649 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -399,6 +399,9 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
}
}
+ // NewFromSpec() is deprecated according to its comment
+ // however the recommended replace just causes a nil map panic
+ //nolint:staticcheck
g := generate.NewFromSpec(c.config.Spec)
// If network namespace was requested, add it now
@@ -1520,6 +1523,10 @@ func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointO
func (c *Container) generateContainerSpec() error {
// Make sure the newly created config.json exists on disk
+
+ // NewFromSpec() is deprecated according to its comment
+ // however the recommended replace just causes a nil map panic
+ //nolint:staticcheck
g := generate.NewFromSpec(c.config.Spec)
if err := c.saveSpec(g.Config); err != nil {
diff --git a/libpod/healthcheck_linux.go b/libpod/healthcheck_linux.go
index 51def1927..45b3a0e41 100644
--- a/libpod/healthcheck_linux.go
+++ b/libpod/healthcheck_linux.go
@@ -56,7 +56,7 @@ func (c *Container) startTimer() error {
return errors.Wrapf(err, "unable to get systemd connection to start healthchecks")
}
defer conn.Close()
- _, err = conn.StartUnit(fmt.Sprintf("%s.service", c.ID()), "fail", nil)
+ _, err = conn.StartUnitContext(context.Background(), fmt.Sprintf("%s.service", c.ID()), "fail", nil)
return err
}
diff --git a/libpod/options.go b/libpod/options.go
index ffd0e6037..4e597201a 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -936,6 +936,9 @@ func WithUserNSFrom(nsCtr *Container) CtrCreateOption {
if err := JSONDeepCopy(nsCtr.IDMappings(), &ctr.config.IDMappings); err != nil {
return err
}
+ // NewFromSpec() is deprecated according to its comment
+ // however the recommended replace just causes a nil map panic
+ //nolint:staticcheck
g := generate.NewFromSpec(ctr.config.Spec)
g.ClearLinuxUIDMappings()
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 7edd49fd1..a62c2b607 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -397,6 +397,10 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai
if ctr.restoreFromCheckpoint {
// Remove information about bind mount
// for new container from imported checkpoint
+
+ // NewFromSpec() is deprecated according to its comment
+ // however the recommended replace just causes a nil map panic
+ //nolint:staticcheck
g := generate.NewFromSpec(ctr.config.Spec)
g.RemoveMount("/dev/shm")
ctr.config.ShmDir = ""
diff --git a/pkg/api/handlers/libpod/manifests.go b/pkg/api/handlers/libpod/manifests.go
index b823a56b6..904a9213d 100644
--- a/pkg/api/handlers/libpod/manifests.go
+++ b/pkg/api/handlers/libpod/manifests.go
@@ -100,10 +100,10 @@ func ManifestCreate(w http.ResponseWriter, r *http.Request) {
// gather all images for manifest list
var images []string
if len(query.Images) > 0 {
- images = append(query.Images)
+ images = query.Images
}
if len(body.Images) > 0 {
- images = append(body.Images)
+ images = body.Images
}
id, err := imageEngine.ManifestAdd(r.Context(), query.Name, images, body.ManifestAddOptions)
diff --git a/pkg/api/server/register_manifest.go b/pkg/api/server/register_manifest.go
index 58def109e..88df6910d 100644
--- a/pkg/api/server/register_manifest.go
+++ b/pkg/api/server/register_manifest.go
@@ -167,6 +167,7 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// $ref: "#/responses/BadParamError"
// 500:
// $ref: "#/responses/InternalError"
+ //lint:ignore SA1019 We still want to support the V3 endpoints
v3.Handle("/{name:.*}/add", s.APIHandler(libpod.ManifestAdd)).Methods(http.MethodPost)
// swagger:operation DELETE /libpod/manifests/{name} manifests ManifestDeleteV3Libpod
// ---
@@ -197,6 +198,7 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// $ref: "#/responses/NoSuchManifest"
// 500:
// $ref: "#/responses/InternalError"
+ //lint:ignore SA1019 We still want to support the V3 endpoints
v3.Handle("/{name:.*}", s.APIHandler(libpod.ManifestRemoveDigest)).Methods(http.MethodDelete)
// swagger:operation DELETE /libpod/manifests/{name} manifests ManifestDeleteLibpod
// ---
@@ -255,6 +257,7 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// $ref: "#/responses/NoSuchManifest"
// 500:
// $ref: "#/responses/InternalError"
+ //lint:ignore SA1019 We still want to support the V3 endpoints
v3.Handle("/{name}/push", s.APIHandler(libpod.ManifestPushV3)).Methods(http.MethodPost)
// swagger:operation POST /libpod/manifests/{name}/registry/{destination} manifests ManifestPushLibpod
// ---
diff --git a/pkg/bindings/test/images_test.go b/pkg/bindings/test/images_test.go
index d667a2dee..a005be6ac 100644
--- a/pkg/bindings/test/images_test.go
+++ b/pkg/bindings/test/images_test.go
@@ -103,7 +103,7 @@ var _ = Describe("Podman images", func() {
Expect(len(errs)).To(BeZero())
Expect(inspectData.ID).To(Equal(response.Deleted[0]))
- inspectData, err = images.GetImage(bt.conn, busybox.shortName, nil)
+ _, err = images.GetImage(bt.conn, busybox.shortName, nil)
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
@@ -118,7 +118,7 @@ var _ = Describe("Podman images", func() {
// try to remove the image "alpine". This should fail since we are not force
// deleting hence image cannot be deleted until the container is deleted.
- response, errs = images.Remove(bt.conn, []string{alpine.shortName}, nil)
+ _, errs = images.Remove(bt.conn, []string{alpine.shortName}, nil)
code, _ = bindings.CheckResponseCode(errs[0])
// FIXME FIXME FIXME: #12441: another invalid error
// FIXME FIXME FIXME: this time msg="Image used by SHA: ..."
@@ -126,7 +126,7 @@ var _ = Describe("Podman images", func() {
// Removing the image "alpine" where force = true
options := new(images.RemoveOptions).WithForce(true)
- response, errs = images.Remove(bt.conn, []string{alpine.shortName}, options)
+ _, errs = images.Remove(bt.conn, []string{alpine.shortName}, options)
Expect(errs).To(Or(HaveLen(0), BeNil()))
// To be extra sure, check if the previously created container
// is gone as well.
@@ -135,11 +135,11 @@ var _ = Describe("Podman images", func() {
Expect(code).To(BeNumerically("==", http.StatusNotFound))
// Now make sure both images are gone.
- inspectData, err = images.GetImage(bt.conn, busybox.shortName, nil)
+ _, err = images.GetImage(bt.conn, busybox.shortName, nil)
code, _ = bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
- inspectData, err = images.GetImage(bt.conn, alpine.shortName, nil)
+ _, err = images.GetImage(bt.conn, alpine.shortName, nil)
code, _ = bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
})
@@ -230,8 +230,8 @@ var _ = Describe("Podman images", func() {
Expect(err).ToNot(HaveOccurred())
Expect(exists).To(BeFalse())
f, err := os.Open(filepath.Join(ImageCacheDir, alpine.tarballName))
- defer f.Close()
Expect(err).ToNot(HaveOccurred())
+ defer f.Close()
names, err := images.Load(bt.conn, f)
Expect(err).ToNot(HaveOccurred())
Expect(names.Names[0]).To(Equal(alpine.name))
@@ -252,8 +252,6 @@ var _ = Describe("Podman images", func() {
Expect(names.Names[0]).To(Equal(alpine.name))
// load with a bad repo name should trigger a 500
- f, err = os.Open(filepath.Join(ImageCacheDir, alpine.tarballName))
- Expect(err).ToNot(HaveOccurred())
_, errs = images.Remove(bt.conn, []string{alpine.name}, nil)
Expect(len(errs)).To(BeZero())
exists, err = images.Exists(bt.conn, alpine.name, nil)
@@ -265,8 +263,8 @@ var _ = Describe("Podman images", func() {
// Export an image
exportPath := filepath.Join(bt.tempDirPath, alpine.tarballName)
w, err := os.Create(filepath.Join(bt.tempDirPath, alpine.tarballName))
- defer w.Close()
Expect(err).ToNot(HaveOccurred())
+ defer w.Close()
err = images.Export(bt.conn, []string{alpine.name}, w, nil)
Expect(err).ToNot(HaveOccurred())
_, err = os.Stat(exportPath)
@@ -283,8 +281,8 @@ var _ = Describe("Podman images", func() {
Expect(err).ToNot(HaveOccurred())
Expect(exists).To(BeFalse())
f, err := os.Open(filepath.Join(ImageCacheDir, alpine.tarballName))
- defer f.Close()
Expect(err).ToNot(HaveOccurred())
+ defer f.Close()
changes := []string{"CMD /bin/foobar"}
testMessage := "test_import"
options := new(images.ImportOptions).WithMessage(testMessage).WithChanges(changes).WithReference(alpine.name)
diff --git a/pkg/bindings/test/secrets_test.go b/pkg/bindings/test/secrets_test.go
index 377f49b2f..b4595f025 100644
--- a/pkg/bindings/test/secrets_test.go
+++ b/pkg/bindings/test/secrets_test.go
@@ -64,7 +64,7 @@ var _ = Describe("Podman secrets", func() {
Expect(data.Spec.Name).To(Equal(name))
// inspecting non-existent secret should fail
- data, err = secrets.Inspect(connText, "notasecret", nil)
+ _, err = secrets.Inspect(connText, "notasecret", nil)
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusNotFound))
})
diff --git a/pkg/domain/infra/tunnel/pods.go b/pkg/domain/infra/tunnel/pods.go
index 4f44e7e4a..2dbdfcf80 100644
--- a/pkg/domain/infra/tunnel/pods.go
+++ b/pkg/domain/infra/tunnel/pods.go
@@ -42,14 +42,14 @@ func (ic *ContainerEngine) PodKill(ctx context.Context, namesOrIds []string, opt
return reports, nil
}
-func (ic *ContainerEngine) PodLogs(_ context.Context, nameOrIDs string, options entities.PodLogsOptions) error {
+func (ic *ContainerEngine) PodLogs(ctx context.Context, nameOrIDs string, options entities.PodLogsOptions) error {
// PodLogsOptions are similar but contains few extra fields like ctrName
// So cast other values as is so we can re-use the code
containerLogsOpts := entities.PodLogsOptionsToContainerLogsOptions(options)
// interface only accepts slice, keep everything consistent
name := []string{options.ContainerName}
- return ic.ContainerLogs(nil, name, containerLogsOpts)
+ return ic.ContainerLogs(ctx, name, containerLogsOpts)
}
func (ic *ContainerEngine) PodPause(ctx context.Context, namesOrIds []string, options entities.PodPauseOptions) ([]*entities.PodPauseReport, error) {
diff --git a/pkg/machine/fcos.go b/pkg/machine/fcos.go
index 6215ae08f..ad1be15c7 100644
--- a/pkg/machine/fcos.go
+++ b/pkg/machine/fcos.go
@@ -139,7 +139,7 @@ func getStreamURL(streamType string) url2.URL {
// This should get Exported and stay put as it will apply to all fcos downloads
// getFCOS parses fedoraCoreOS's stream and returns the image download URL and the release version
-func getFCOSDownload(imageStream string) (*fcosDownloadInfo, error) {
+func getFCOSDownload(imageStream string) (*fcosDownloadInfo, error) { // nolint:staticcheck
var (
fcosstable stream.Stream
altMeta release.Release
@@ -149,6 +149,8 @@ func getFCOSDownload(imageStream string) (*fcosDownloadInfo, error) {
// This is being hard set to testing. Once podman4 is in the
// fcos trees, we should remove it and re-release at least on
// macs.
+ // TODO: remove when podman4.0 is in coreos
+ // nolint:staticcheck
imageStream = "podman-testing"
switch imageStream {
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index df751a780..51f9fa535 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -82,7 +82,7 @@ func ToPodOpt(ctx context.Context, podName string, p entities.PodCreateOptions,
}
// dns options
if options := dnsConfig.Options; len(options) > 0 {
- dnsOptions := make([]string, 0)
+ dnsOptions := make([]string, 0, len(options))
for _, opts := range options {
d := opts.Name
if opts.Value != nil {
@@ -90,6 +90,7 @@ func ToPodOpt(ctx context.Context, podName string, p entities.PodCreateOptions,
}
dnsOptions = append(dnsOptions, d)
}
+ p.Net.DNSOptions = dnsOptions
}
}
return p, nil
@@ -281,9 +282,6 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
annotations = opts.Annotations
}
if opts.PodInfraID != "" {
- if annotations == nil {
-
- }
annotations[ann.SandboxID] = opts.PodInfraID
annotations[ann.ContainerType] = ann.ContainerTypeContainer
}
diff --git a/pkg/systemd/dbus.go b/pkg/systemd/dbus.go
index 44feb8308..b35f778ab 100644
--- a/pkg/systemd/dbus.go
+++ b/pkg/systemd/dbus.go
@@ -1,6 +1,7 @@
package systemd
import (
+ "context"
"fmt"
"os"
"path/filepath"
@@ -140,5 +141,5 @@ func ConnectToDBUS() (*dbus.Conn, error) {
if rootless.IsRootless() {
return newRootlessConnection()
}
- return dbus.NewSystemdConnection()
+ return dbus.NewSystemdConnectionContext(context.Background())
}
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 7b2dd89c9..2dc99bdc9 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -1061,7 +1061,7 @@ var _ = Describe("Podman checkpoint", func() {
// Open a network connection to the redis server via initial port mapping
// This should fail
- conn, err = net.DialTimeout("tcp4", fmt.Sprintf("localhost:%d", randomPort), time.Duration(3)*time.Second)
+ _, err = net.DialTimeout("tcp4", fmt.Sprintf("localhost:%d", randomPort), time.Duration(3)*time.Second)
Expect(err).ToNot(BeNil())
Expect(err.Error()).To(ContainSubstring("connection refused"))
// Open a network connection to the redis server via new port mapping
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 2f4146bba..f808eb2b6 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -880,11 +880,11 @@ func (p *PodmanTestIntegration) makeOptions(args []string, noEvents, noCache boo
func writeConf(conf []byte, confPath string) {
if _, err := os.Stat(filepath.Dir(confPath)); os.IsNotExist(err) {
- if err := os.MkdirAll(filepath.Dir(confPath), 777); err != nil {
+ if err := os.MkdirAll(filepath.Dir(confPath), 0o777); err != nil {
fmt.Println(err)
}
}
- if err := ioutil.WriteFile(confPath, conf, 777); err != nil {
+ if err := ioutil.WriteFile(confPath, conf, 0o777); err != nil {
fmt.Println(err)
}
}
diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go
index 77549a9a8..001779cdf 100644
--- a/test/e2e/login_logout_test.go
+++ b/test/e2e/login_logout_test.go
@@ -188,6 +188,8 @@ var _ = Describe("Podman login and logout", func() {
Expect(session).To(ExitWithError())
session = podmanTest.Podman([]string{"logout", "--authfile", authFile, server})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
})
It("podman login and logout with --tls-verify", func() {
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index a8a98fc07..3b571ab20 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -220,6 +220,7 @@ var _ = Describe("Podman push", func() {
if setup.LineInOutputContains("Active: inactive") {
setup = SystemExec("systemctl", []string{"start", "docker"})
+ Expect(setup).Should(Exit(0))
defer func() {
stop := SystemExec("systemctl", []string{"stop", "docker"})
Expect(stop).Should(Exit(0))
diff --git a/test/e2e/systemd_activate_test.go b/test/e2e/systemd_activate_test.go
index d5434868d..04acafe1b 100644
--- a/test/e2e/systemd_activate_test.go
+++ b/test/e2e/systemd_activate_test.go
@@ -97,7 +97,7 @@ var _ = Describe("Systemd activate", func() {
// Emulate 'systemd stop podman.service'
activateSession.Signal(syscall.SIGTERM)
- time.Sleep(2)
+ time.Sleep(100 * time.Millisecond)
Eventually(activateSession).Should(Exit(0))
abiSession := podman("inspect", "--format={{.State.Running}}", containerName)
diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go
index 6323b44eb..a73d75490 100644
--- a/test/utils/common_function_test.go
+++ b/test/utils/common_function_test.go
@@ -110,9 +110,8 @@ var _ = Describe("Common functions test", func() {
Expect(err).To(BeNil(), "Failed to write JSON to file.")
read, err := os.Open("/tmp/testJSON")
- defer read.Close()
-
Expect(err).To(BeNil(), "Can not find the JSON file after we write it.")
+ defer read.Close()
bytes, _ := ioutil.ReadAll(read)
json.Unmarshal(bytes, compareData)
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 39a0ac875..9695835e5 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -439,10 +439,10 @@ func tagOutputToMap(imagesOutput []string) map[string]map[string]bool {
// GetHostDistributionInfo returns a struct with its distribution Name and version
func GetHostDistributionInfo() HostOS {
f, err := os.Open(OSReleasePath)
- defer f.Close()
if err != nil {
return HostOS{}
}
+ defer f.Close()
l := bufio.NewScanner(f)
host := HostOS{}
diff --git a/test/version/main.go b/test/version/main.go
index 8f2904405..2a68aa5fc 100644
--- a/test/version/main.go
+++ b/test/version/main.go
@@ -7,5 +7,5 @@ import (
)
func main() {
- fmt.Printf(version.Version.String())
+ fmt.Print(version.Version.String())
}
diff --git a/utils/utils_supported.go b/utils/utils_supported.go
index ab2de2ce1..493ea61ce 100644
--- a/utils/utils_supported.go
+++ b/utils/utils_supported.go
@@ -6,6 +6,7 @@ package utils
import (
"bufio"
"bytes"
+ "context"
"fmt"
"io/ioutil"
"os"
@@ -32,7 +33,7 @@ func RunUnderSystemdScope(pid int, slice string, unitName string) error {
return err
}
} else {
- conn, err = systemdDbus.New()
+ conn, err = systemdDbus.NewWithContext(context.Background())
if err != nil {
return err
}
@@ -43,10 +44,10 @@ func RunUnderSystemdScope(pid int, slice string, unitName string) error {
properties = append(properties, newProp("Delegate", true))
properties = append(properties, newProp("DefaultDependencies", false))
ch := make(chan string)
- _, err = conn.StartTransientUnit(unitName, "replace", properties, ch)
+ _, err = conn.StartTransientUnitContext(context.Background(), unitName, "replace", properties, ch)
if err != nil {
// On errors check if the cgroup already exists, if it does move the process there
- if props, err := conn.GetUnitTypeProperties(unitName, "Scope"); err == nil {
+ if props, err := conn.GetUnitTypePropertiesContext(context.Background(), unitName, "Scope"); err == nil {
if cgroup, ok := props["ControlGroup"].(string); ok && cgroup != "" {
if err := moveUnderCgroup(cgroup, "", []uint32{uint32(pid)}); err == nil {
return nil