Skip to content

Commit 6223aec

Browse files
committed
chore: update implementation
1 parent d0625e7 commit 6223aec

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

.golangci.next.reference.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ linters:
392392
- "0C0C"
393393

394394
embeddedstructfieldcheck:
395+
# Checks that there is an empty space between the embedded fields and regular fields.
396+
# Default: true
397+
empty-line: false
395398
# Checks that sync.Mutex and sync.RWMutex are not used as embedded fields.
396399
# Default: false
397400
forbid-mutex: true

jsonschema/golangci.next.jsonschema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,11 @@
11261126
"type": "object",
11271127
"additionalProperties": false,
11281128
"properties": {
1129+
"empty-line": {
1130+
"description": "Checks that there is an empty space between the embedded fields and regular fields.",
1131+
"type": "boolean",
1132+
"default": false
1133+
},
11291134
"forbid-mutex": {
11301135
"description": "Checks that sync.Mutex and sync.RWMutex are not used as embedded fields.",
11311136
"type": "boolean",

pkg/config/linters_settings.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ var defaultLintersSettings = LintersSettings{
2424
Dupl: DuplSettings{
2525
Threshold: 150,
2626
},
27+
EmbeddedStructFieldCheck: EmbeddedStructFieldCheckSettings{
28+
EmptyLine: true,
29+
},
2730
ErrorLint: ErrorLintSettings{
2831
Errorf: true,
2932
ErrorfMulti: true,
@@ -380,6 +383,7 @@ type DupWordSettings struct {
380383

381384
type EmbeddedStructFieldCheckSettings struct {
382385
ForbidMutex bool `mapstructure:"forbid-mutex"`
386+
EmptyLine bool `mapstructure:"empty-line"`
383387
}
384388

385389
type ErrcheckSettings struct {

pkg/golinters/embeddedstructfieldcheck/embeddedstructfieldcheck.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ func New(settings *config.EmbeddedStructFieldCheckSettings) *goanalysis.Linter {
1212

1313
if settings != nil {
1414
cfg = map[string]any{
15-
analyzer.ForbidMutexName: settings.ForbidMutex,
15+
analyzer.ForbidMutexCheck: settings.ForbidMutex,
16+
analyzer.EmptyLineCheck: settings.EmptyLine,
1617
}
1718
}
1819

0 commit comments

Comments
 (0)