Skip to content
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

gofumpt: add module-path setting #2644

Merged
merged 2 commits into from
Mar 12, 2022
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
4 changes: 4 additions & 0 deletions .golangci.example.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var defaultLintersSettings = LintersSettings{
},
Gofumpt: GofumptSettings{
LangVersion: "",
ModulePath: "",
ldez marked this conversation as resolved.
Show resolved Hide resolved
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func NewGofumpt() *goanalysis.Linter {

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

Expand Down