Skip to content

Commit

Permalink
Forbid print statements (prometheus#668)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
SuperQ authored and fs185143 committed Nov 26, 2024
1 parent 4f679da commit 50915e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
linters:
enable:
- errcheck
- forbidigo
- godot
- gofmt
- goimports
Expand All @@ -15,6 +16,10 @@ linters:
- unused

linter-settings:
forbidigo:
forbid:
- p: ^fmt\.Print.*$
msg: Do not commit print statements.
godot:
capital: true
exclude:
Expand Down
2 changes: 0 additions & 2 deletions proc_smaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package procfs
import (
"bufio"
"errors"
"fmt"
"os"
"regexp"
"strconv"
Expand Down Expand Up @@ -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")
}

Expand Down

0 comments on commit 50915e8

Please sign in to comment.