Skip to content

Commit

Permalink
gofumpt: add module-path setting (#2644)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpreese committed Mar 12, 2022
1 parent 93a0015 commit 42ca644
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .golangci.example.yml
Expand Up @@ -511,6 +511,10 @@ linters-settings:
# Default: 1.15
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.
# Default: false
extra-rules: true
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/linters_settings.go
Expand Up @@ -49,6 +49,7 @@ var defaultLintersSettings = LintersSettings{
},
Gofumpt: GofumptSettings{
LangVersion: "",
ModulePath: "",
ExtraRules: false,
},
Gosec: GoSecSettings{
Expand Down Expand Up @@ -311,6 +312,7 @@ type GoFmtSettings struct {

type GofumptSettings struct {
LangVersion string `mapstructure:"lang-version"`
ModulePath string `mapstructure:"module-path"`
ExtraRules bool `mapstructure:"extra-rules"`
}

Expand Down
1 change: 1 addition & 0 deletions pkg/golinters/gofumpt.go
Expand Up @@ -37,6 +37,7 @@ func NewGofumpt() *goanalysis.Linter {

options := format.Options{
LangVersion: getLangVersion(settings),
ModulePath: settings.ModulePath,
ExtraRules: settings.ExtraRules,
}

Expand Down

0 comments on commit 42ca644

Please sign in to comment.