Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a linter to catch fmt.Print* #4782

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading