Skip to content

Commit 020b032

Browse files
committed
chore(plugins): replace viper.ConfigFileUsed() by cfg.GetConfigDir()
1 parent 244424d commit 020b032

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

pkg/lint/lintersdb/custom_linters.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"path/filepath"
77
"plugin"
88

9-
"github.com/spf13/viper"
109
"golang.org/x/tools/go/analysis"
1110

1211
"github.com/golangci/golangci-lint/pkg/config"
@@ -67,12 +66,7 @@ func (m *Manager) loadCustomLinterConfig(name string, settings config.CustomLint
6766
func (m *Manager) getAnalyzerPlugin(path string, settings any) ([]*analysis.Analyzer, error) {
6867
if !filepath.IsAbs(path) {
6968
// resolve non-absolute paths relative to config file's directory
70-
configFilePath := viper.ConfigFileUsed()
71-
absConfigFilePath, err := filepath.Abs(configFilePath)
72-
if err != nil {
73-
return nil, fmt.Errorf("could not get absolute representation of config file path %q: %w", configFilePath, err)
74-
}
75-
path = filepath.Join(filepath.Dir(absConfigFilePath), path)
69+
path = filepath.Join(m.cfg.GetConfigDir(), path)
7670
}
7771

7872
plug, err := plugin.Open(path)

0 commit comments

Comments
 (0)