Skip to content

Commit

Permalink
Forbid print statements
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 committed Sep 23, 2024
1 parent 1808690 commit 5f4cfe1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 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,9 @@ linters:
- unused

linter-settings:
forbidigo:
forbid:
- 'fmt\.Print.*(# 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 5f4cfe1

Please sign in to comment.