Skip to content

Commit 0879174

Browse files
committed
fix: use logger
1 parent 10c05a3 commit 0879174

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

pkg/goformatters/gci/gci.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
gcicfg "github.com/daixiang0/gci/pkg/config"
77
"github.com/daixiang0/gci/pkg/gci"
88
"github.com/daixiang0/gci/pkg/log"
9+
"github.com/golangci/golangci-lint/pkg/goformatters/internal"
910
"github.com/ldez/grignotin/gomod"
1011

1112
"github.com/golangci/golangci-lint/pkg/config"
@@ -23,7 +24,7 @@ func New(settings *config.GciSettings) (*Formatter, error) {
2324

2425
modPath, err := gomod.GetModulePath()
2526
if err != nil {
26-
return nil, err
27+
internal.LinterLogger.Errorf("gci: %v", err)
2728
}
2829

2930
cfg := gcicfg.YamlConfig{

pkg/goformatters/internal/commons.go

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package internal
2+
3+
import "github.com/golangci/golangci-lint/pkg/logutils"
4+
5+
// LinterLogger must be use only when the context logger is not available.
6+
var LinterLogger = logutils.NewStderrLog(logutils.DebugKeyFormatter)

pkg/logutils/logutils.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ const (
2525
DebugKeyExcludeRules = "exclude_rules"
2626
DebugKeyExec = "exec"
2727
DebugKeyFilenameUnadjuster = "filename_unadjuster"
28-
DebugKeyInvalidIssue = "invalid_issue"
2928
DebugKeyForbidigo = "forbidigo"
29+
DebugKeyFormatter = "formatter"
3030
DebugKeyGoEnv = "goenv"
31+
DebugKeyInvalidIssue = "invalid_issue"
3132
DebugKeyLinter = "linter"
3233
DebugKeyLintersContext = "linters_context"
3334
DebugKeyLintersDB = "lintersdb"

0 commit comments

Comments
 (0)