gofumpt: add module-path setting (#2644)

This commit is contained in:
John Reese 2022-03-12 12:56:42 -05:00 committed by GitHub
parent 93a0015cfc
commit 42ca644953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -511,6 +511,10 @@ linters-settings:
# Default: 1.15 # Default: 1.15
lang-version: "1.17" lang-version: "1.17"
# Module path which contains the source code being formatted.
# Default: empty string
module-path: github.com/org/project
# Choose whether to use the extra rules. # Choose whether to use the extra rules.
# Default: false # Default: false
extra-rules: true extra-rules: true

View File

@ -49,6 +49,7 @@ var defaultLintersSettings = LintersSettings{
}, },
Gofumpt: GofumptSettings{ Gofumpt: GofumptSettings{
LangVersion: "", LangVersion: "",
ModulePath: "",
ExtraRules: false, ExtraRules: false,
}, },
Gosec: GoSecSettings{ Gosec: GoSecSettings{
@ -311,6 +312,7 @@ type GoFmtSettings struct {
type GofumptSettings struct { type GofumptSettings struct {
LangVersion string `mapstructure:"lang-version"` LangVersion string `mapstructure:"lang-version"`
ModulePath string `mapstructure:"module-path"`
ExtraRules bool `mapstructure:"extra-rules"` ExtraRules bool `mapstructure:"extra-rules"`
} }

View File

@ -37,6 +37,7 @@ func NewGofumpt() *goanalysis.Linter {
options := format.Options{ options := format.Options{
LangVersion: getLangVersion(settings), LangVersion: getLangVersion(settings),
ModulePath: settings.ModulePath,
ExtraRules: settings.ExtraRules, ExtraRules: settings.ExtraRules,
} }