From 479817dea10aa0801d05de9d72b94ae95309906c Mon Sep 17 00:00:00 2001 From: SuperQ Date: Mon, 23 Sep 2024 01:54:18 +0200 Subject: [PATCH] Forbid print statements Enable `forbidigo` to make sure print statements are not used in this library. This avoids injecting random log output into upstream user's log formatting. Signed-off-by: SuperQ --- .golangci.yml | 5 +++++ proc_smaps.go | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d7476d56..e07e8211 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,6 +2,7 @@ linters: enable: - errcheck + - forbidigo - godot - gofmt - goimports @@ -15,6 +16,10 @@ linters: - unused linter-settings: + forbidigo: + forbid: + - p: ^fmt\.Print.*$ + msg: Do not commit print statements. godot: capital: true exclude: diff --git a/proc_smaps.go b/proc_smaps.go index 09060e82..07e7e650 100644 --- a/proc_smaps.go +++ b/proc_smaps.go @@ -19,7 +19,6 @@ package procfs import ( "bufio" "errors" - "fmt" "os" "regexp" "strconv" @@ -117,7 +116,6 @@ func (p Proc) procSMapsRollupManual() (ProcSMapsRollup, error) { func (s *ProcSMapsRollup) parseLine(line string) error { kv := strings.SplitN(line, ":", 2) if len(kv) != 2 { - fmt.Println(line) return errors.New("invalid net/dev line, missing colon") }