forked from golangci/golangci-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disable zap by default timonwong/loggercheck#27
Signed-off-by: Timon Wong <[email protected]>
- Loading branch information
Showing
6 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
linters-settings: | ||
loggercheck: | ||
zap: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//golangcitest:args -Eloggercheck | ||
package loggercheck | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/go-logr/logr" | ||
"go.uber.org/zap" | ||
"k8s.io/klog/v2" | ||
) | ||
|
||
func ExampleDefaultLogr() { | ||
log := logr.Discard() | ||
log = log.WithValues("key") // want `odd number of arguments passed as key-value pairs for logging` | ||
log.Info("message", "key1", "value1", "key2", "value2", "key3") // want `odd number of arguments passed as key-value pairs for logging` | ||
log.Error(fmt.Errorf("error"), "message", "key1", "value1", "key2") // want `odd number of arguments passed as key-value pairs for logging` | ||
log.Error(fmt.Errorf("error"), "message", "key1", "value1", "key2", "value2") | ||
} | ||
|
||
func ExampleDefaultKlog() { | ||
klog.InfoS("message", "key1") // want `odd number of arguments passed as key-value pairs for logging` | ||
} | ||
|
||
func ExampleZapSugarNotChecked() { | ||
sugar := zap.NewExample().Sugar() | ||
defer sugar.Sync() | ||
sugar.Infow("message", "key1", "value1", "key2") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters