diff --git a/cmd/security-agent/subcommands/runtime/command.go b/cmd/security-agent/subcommands/runtime/command.go index 2b1865ef24b1e..8451c549889f2 100644 --- a/cmd/security-agent/subcommands/runtime/command.go +++ b/cmd/security-agent/subcommands/runtime/command.go @@ -352,7 +352,7 @@ func dumpNetworkNamespace(_ log.Component, _ config.Component, _ secrets.Compone } if len(resp.GetError()) > 0 { - return fmt.Errorf("couldn't dump network namespaces: %w", err) + return fmt.Errorf("couldn't dump network namespaces: %s", resp.GetError()) } fmt.Printf("Network namespace dump: %s\n", resp.GetDumpFilename()) diff --git a/cmd/system-probe/subcommands/runtime/command.go b/cmd/system-probe/subcommands/runtime/command.go index 2bce948b2764c..9e9a7f77a63cd 100644 --- a/cmd/system-probe/subcommands/runtime/command.go +++ b/cmd/system-probe/subcommands/runtime/command.go @@ -346,7 +346,7 @@ func dumpNetworkNamespace(_ log.Component, _ config.Component, _ secrets.Compone } if len(resp.GetError()) > 0 { - return fmt.Errorf("couldn't dump network namespaces: %w", err) + return fmt.Errorf("couldn't dump network namespaces: %s", resp.GetError()) } fmt.Printf("Network namespace dump: %s\n", resp.GetDumpFilename()) diff --git a/pkg/ebpf/bytecode/permissions.go b/pkg/ebpf/bytecode/permissions.go index 431eccd0caef2..544dad0635822 100644 --- a/pkg/ebpf/bytecode/permissions.go +++ b/pkg/ebpf/bytecode/permissions.go @@ -24,7 +24,7 @@ func VerifyAssetPermissions(assetPath string) error { } stat, ok := info.Sys().(*syscall.Stat_t) if !ok { - return fmt.Errorf("error getting permissions for output file %s: %w", assetPath, err) + return fmt.Errorf("error getting permissions for output file %s", assetPath) } if stat.Uid != 0 || stat.Gid != 0 || info.Mode().Perm()&os.FileMode(0022) != 0 { return fmt.Errorf("%s has incorrect permissions: user=%v, group=%v, permissions=%v", assetPath, stat.Uid, stat.Gid, info.Mode().Perm()) diff --git a/pkg/fleet/installer/service/datadog_installer.go b/pkg/fleet/installer/service/datadog_installer.go index 88232338001ea..ca41e32956916 100644 --- a/pkg/fleet/installer/service/datadog_installer.go +++ b/pkg/fleet/installer/service/datadog_installer.go @@ -52,7 +52,7 @@ func SetupInstaller(ctx context.Context) (err error) { if err = addDDAgentGroup(ctx); err != nil { return fmt.Errorf("error creating dd-agent group: %w", err) } - if addDDAgentUser(ctx) != nil { + if err = addDDAgentUser(ctx); err != nil { return fmt.Errorf("error creating dd-agent user: %w", err) } err = exec.CommandContext(ctx, "usermod", "-g", "dd-agent", "dd-agent").Run() diff --git a/pkg/security/probe/monitors/runtime/runtime_monitor.go b/pkg/security/probe/monitors/runtime/runtime_monitor.go index 94238a1ba3ebd..403cba55e8052 100644 --- a/pkg/security/probe/monitors/runtime/runtime_monitor.go +++ b/pkg/security/probe/monitors/runtime/runtime_monitor.go @@ -58,7 +58,7 @@ func (m *Monitor) sendCgroupMetrics() error { } } if len(memoryCgroup.Path) == 0 { - return fmt.Errorf("couldn't find memory controller in: %v: %w", cgroups, err) + return fmt.Errorf("couldn't find memory controller in: %v", cgroups) } usageInBytes, err := utils.ParseCgroupFileValue("memory", memoryCgroup.Path, "memory.usage_in_bytes") diff --git a/pkg/util/containers/metrics/system/collector_linux.go b/pkg/util/containers/metrics/system/collector_linux.go index 0c8eabdfd7f91..8de32d49e825f 100644 --- a/pkg/util/containers/metrics/system/collector_linux.go +++ b/pkg/util/containers/metrics/system/collector_linux.go @@ -240,7 +240,7 @@ func (c *systemCollector) GetContainerIDForInode(inode uint64, cacheValidity tim cg = c.reader.GetCgroupByInode(inode) if cg == nil { - return "", fmt.Errorf("containerID not found from inode %d, err: %w", inode, err) + return "", fmt.Errorf("containerID not found from inode %d", inode) } }