Skip to content

build(deps): bump github.com/ldez/gomoddirectives from 0.4.2 to 0.5.0 #5187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1355,17 +1355,29 @@ linters-settings:
gomoddirectives:
# Allow local `replace` directives.
# Default: false
replace-local: false
replace-local: true
# List of allowed `replace` directives.
# Default: []
replace-allow-list:
- launchpad.net/gocheck
# Allow to not explain why the version has been retracted in the `retract` directives.
# Default: false
retract-allow-no-explanation: false
retract-allow-no-explanation: true
# Forbid the use of the `exclude` directives.
# Default: false
exclude-forbidden: false
exclude-forbidden: true
# Forbid the use of the `toolchain` directive.
# Default: false
toolchain-forbidden: true
# Forbid the use of the `tool` directives.
# Default: false
tool-forbidden: true
# Forbid the use of the `godebug` directive.
# Default: false
go-debug-forbidden: true
# Defines a pattern to validate `go` minimum version directive.
# Default: '' (no match)
go-version-pattern: '\d\.\d+(\.0)?'

gomodguard:
allowed:
Expand Down
8 changes: 5 additions & 3 deletions .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1353,17 +1353,19 @@ linters-settings:
gomoddirectives:
# Allow local `replace` directives.
# Default: false
replace-local: false
replace-local: true

# List of allowed `replace` directives.
# Default: []
replace-allow-list:
- launchpad.net/gocheck
# Allow to not explain why the version has been retracted in the `retract` directives.
# Default: false
retract-allow-no-explanation: false
retract-allow-no-explanation: true

# Forbid the use of the `exclude` directives.
# Default: false
exclude-forbidden: false
exclude-forbidden: true

gomodguard:
allowed:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ require (
github.com/kunwardeep/paralleltest v1.0.10
github.com/kyoh86/exportloopref v0.1.11
github.com/lasiar/canonicalheader v1.1.2
github.com/ldez/gomoddirectives v0.4.2
github.com/ldez/gomoddirectives v0.5.0
github.com/ldez/grignotin v0.6.0
github.com/ldez/tagliatelle v0.6.0
github.com/ldez/usetesting v0.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions jsonschema/golangci.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@
"replace-local": {
"description": "Allow local `replace` directives.",
"type": "boolean",
"default": true
"default": false
},
"replace-allow-list": {
"description": "List of allowed `replace` directives.",
Expand All @@ -1650,12 +1650,12 @@
"retract-allow-no-explanation": {
"description": "Allow to not explain why the version has been retracted in the `retract` directives.",
"type": "boolean",
"default": true
"default": false
},
"exclude-forbidden": {
"description": "Forbid the use of the `exclude` directives.",
"type": "boolean",
"default": true
"default": false
}
}
},
Expand Down
24 changes: 22 additions & 2 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1668,12 +1668,32 @@
"retract-allow-no-explanation": {
"description": "Allow to not explain why the version has been retracted in the `retract` directives.",
"type": "boolean",
"default": true
"default": false
},
"exclude-forbidden": {
"description": "Forbid the use of the `exclude` directives.",
"type": "boolean",
"default": true
"default": false
},
"toolchain-forbidden": {
"description": "Forbid the use of the `toolchain` directive.",
"type": "boolean",
"default": false
},
"tool-forbidden": {
"description": "Forbid the use of the `tool` directives.",
"type": "boolean",
"default": false
},
"go-debug-forbidden": {
"description": "Forbid the use of the `godebug` directive.",
"type": "boolean",
"default": false
},
"go-version-pattern": {
"description": "Defines a pattern to validate `go` minimum version directive.",
"type": "string",
"default": ""
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,10 @@ type GoModDirectivesSettings struct {
ReplaceLocal bool `mapstructure:"replace-local"`
ExcludeForbidden bool `mapstructure:"exclude-forbidden"`
RetractAllowNoExplanation bool `mapstructure:"retract-allow-no-explanation"`
ToolchainForbidden bool `mapstructure:"toolchain-forbidden"`
ToolForbidden bool `mapstructure:"tool-forbidden"`
GoDebugForbidden bool `mapstructure:"go-debug-forbidden"`
GoVersionPattern string `mapstructure:"go-version-pattern"`
}

type GoModGuardSettings struct {
Expand Down
14 changes: 14 additions & 0 deletions pkg/golinters/gomoddirectives/gomoddirectives.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package gomoddirectives

import (
"regexp"
"sync"

"github.com/ldez/gomoddirectives"
"golang.org/x/tools/go/analysis"

"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/goanalysis"
"github.com/golangci/golangci-lint/pkg/golinters/internal"
"github.com/golangci/golangci-lint/pkg/lint/linter"
"github.com/golangci/golangci-lint/pkg/result"
)
Expand All @@ -24,6 +26,18 @@ func New(settings *config.GoModDirectivesSettings) *goanalysis.Linter {
opts.ReplaceAllowList = settings.ReplaceAllowList
opts.RetractAllowNoExplanation = settings.RetractAllowNoExplanation
opts.ExcludeForbidden = settings.ExcludeForbidden
opts.ToolchainForbidden = settings.ToolchainForbidden
opts.ToolForbidden = settings.ToolForbidden
opts.GoDebugForbidden = settings.GoDebugForbidden

if settings.GoVersionPattern != "" {
exp, err := regexp.Compile(settings.GoVersionPattern)
if err != nil {
internal.LinterLogger.Fatalf("%s: invalid Go version pattern: %v", linterName, err)
} else {
opts.GoVersionPattern = exp
}
}
}

analyzer := &analysis.Analyzer{
Expand Down
Loading