Skip to content

Commit

Permalink
Add a linter to catch fmt.Print* (#4782)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
	- Introduced a new linter for improved logging practices.
  
- **Bug Fixes**
	- Removed unnecessary `fmt` package usage to streamline output.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
wdbaruni authored Dec 18, 2024
1 parent 71a58d9 commit 7cf0f35
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ linters-settings:
desc: "logging is allowed only by zerolog"
dupl:
threshold: 100
forbidigo:
forbid:
- 'fmt\.Print.*' # This will catch Printf, Println, Print
funlen:
lines: 100
statements: 100
Expand Down Expand Up @@ -70,6 +73,7 @@ linters:
- dogsled
- errcheck
- copyloopvar
- forbidigo
- funlen
- gochecknoinits
- goconst
Expand Down
4 changes: 0 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"context"
"fmt"
"os"
"os/signal"

Expand Down Expand Up @@ -97,7 +96,4 @@ func main() {
// Wait for the context to be cancelled
// either by a signal or by the command completing
<-localCtx.Done()

// Print a newline to ensure the next prompt is on a new line
fmt.Println()
}
3 changes: 1 addition & 2 deletions pkg/config/types/gen/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (

func main() {
if len(os.Args) != 2 {
fmt.Println("Please provide the path to the config directory.")
os.Exit(1)
log.Fatal("Please provide the path to the config directory")
}
pkgPath := os.Args[1]

Expand Down

0 comments on commit 7cf0f35

Please sign in to comment.