From c7f4abc14a8a2f7226a6312cd920e736b36249a3 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 16 Jun 2024 12:24:16 +0200 Subject: [PATCH] pkg/dmesg: use unix.SYSLOG_ACTION_READ_ALL instead of local variable This value was originally added in 46833ee1c353c247e3ef817a08d5a35a2a43bdf3, at which time golang.org/x/sys/unix didn't have utilities for this syscall. A later patch switched the implementation to use the golang/x/sys/unix implementation in 2841b05b71095d662ecb47831d88371e9cb033ff, but kept the local variable. golang.org/x/sys now has a const for this, so let's use it. Signed-off-by: Sebastiaan van Stijn --- pkg/dmesg/dmesg_linux.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/dmesg/dmesg_linux.go b/pkg/dmesg/dmesg_linux.go index 524c35a883..d91179b5ef 100644 --- a/pkg/dmesg/dmesg_linux.go +++ b/pkg/dmesg/dmesg_linux.go @@ -6,9 +6,8 @@ import ( // Dmesg returns last messages from the kernel log, up to size bytes func Dmesg(size int) []byte { - t := 3 // SYSLOG_ACTION_READ_ALL b := make([]byte, size) - amt, err := unix.Klogctl(t, b) + amt, err := unix.Klogctl(unix.SYSLOG_ACTION_READ_ALL, b) if err != nil { return []byte{} }