Skip to content

Commit 645ec86

Browse files
committed
chore: remove configDir placeholder
1 parent 7bcac43 commit 645ec86

File tree

5 files changed

+9
-100
lines changed

5 files changed

+9
-100
lines changed

.golangci.next.reference.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,8 @@ linters-settings:
535535
# Default: "original"
536536
list-mode: lax
537537
# List of file globs that will match this list of settings to compare against.
538+
# By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
539+
# The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
538540
# Default: $all
539541
files:
540542
- "!**/*_a _file.go"
@@ -1364,11 +1366,11 @@ linters-settings:
13641366
# Default: ""
13651367
failOn: dsl,import
13661368
# Comma-separated list of file paths containing ruleguard rules.
1367-
# If a path is relative, it is relative to the directory where the golangci-lint command is executed.
1368-
# The special '${configDir}' variable is substituted with the absolute directory containing the golangci-lint config file.
1369+
# By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
1370+
# The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
13691371
# Glob patterns such as 'rules-*.go' may be specified.
13701372
# Default: ""
1371-
rules: '${configDir}/ruleguard/rules-*.go,${configDir}/myrule1.go'
1373+
rules: '${base-path}/ruleguard/rules-*.go,${base-path}/myrule1.go'
13721374
# Comma-separated list of enabled groups or skip empty to enable everything.
13731375
# Tags can be defined with # character prefix.
13741376
# Default: "<all>"
@@ -1461,6 +1463,8 @@ linters-settings:
14611463
# limitations under the License.
14621464
# As alternative of directive 'template', you may put the path to file with the template source.
14631465
# Useful if you need to load the template from a specific file.
1466+
# By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
1467+
# The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
14641468
# Default: ""
14651469
template-path: /path/to/my/template.tmpl
14661470

pkg/golinters/gocritic/gocritic.go

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ Dynamic rules are written declaratively with AST patterns, filters, report messa
6060
WithContextSetter(func(context *linter.Context) {
6161
wrapper.replacer = strings.NewReplacer(
6262
internal.PlaceholderBasePath, context.Cfg.GetBasePath(),
63-
internal.PlaceholderConfigDir, context.Cfg.GetConfigDir(), //nolint:staticcheck // It must be removed in v2.
6463
)
6564

6665
wrapper.init(context.Log, settings)

pkg/golinters/gocritic/testdata/gocritic_configDir.go

-72
This file was deleted.

pkg/golinters/gocritic/testdata/gocritic_configDir.yml

-16
This file was deleted.

pkg/golinters/internal/commons.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,5 @@ import "github.com/golangci/golangci-lint/pkg/logutils"
55
// LinterLogger must be use only when the context logger is not available.
66
var LinterLogger = logutils.NewStderrLog(logutils.DebugKeyLinter)
77

8-
// Placeholders used inside linters to evaluate relative paths.
9-
const (
10-
PlaceholderBasePath = "${base-path}"
11-
// Deprecated: it must be removed in v2.
12-
// [PlaceholderBasePath] will be the only one placeholder as it is a dynamic value based on
13-
// [github.com/golangci/golangci-lint/pkg/config.Run.RelativePathMode].
14-
PlaceholderConfigDir = "${configDir}"
15-
)
8+
// PlaceholderBasePath used inside linters to evaluate relative paths.
9+
const PlaceholderBasePath = "${base-path}"

0 commit comments

Comments
 (0)