docs: improve grammar in the custom linter article (#4489)
This commit is contained in:
parent
9b5234997f
commit
59202b196d
@ -2,7 +2,7 @@
|
|||||||
# Require.
|
# Require.
|
||||||
version: v1.56.2
|
version: v1.56.2
|
||||||
|
|
||||||
# the name of the custom binary.
|
# The name of the custom binary.
|
||||||
# Optional.
|
# Optional.
|
||||||
# Default: custom-gcl
|
# Default: custom-gcl
|
||||||
name: custom-golangci-lint
|
name: custom-golangci-lint
|
||||||
|
@ -48,5 +48,5 @@ Typically, these linters can't be open-sourced or too specific.
|
|||||||
|
|
||||||
Such linters can be added through 2 plugin systems:
|
Such linters can be added through 2 plugin systems:
|
||||||
|
|
||||||
- [Go Plugin System](/plugins/module-plugins)
|
1. [Go Plugin System](/plugins/module-plugins)
|
||||||
- [Module Plugin System](/plugins/go-plugins)
|
2. [Module Plugin System](/plugins/go-plugins)
|
||||||
|
@ -6,10 +6,10 @@ An example linter can be found at [here](https://github.com/golangci/example-plu
|
|||||||
|
|
||||||
## The Automatic Way
|
## The Automatic Way
|
||||||
|
|
||||||
- define your building configuration into `.custom-gcl.yml`
|
- Define your building configuration into `.custom-gcl.yml`.
|
||||||
- run the command `golangci-lint custom` ( or `golangci-lint custom -v` to have logs)
|
- Run the command `golangci-lint custom` (or `golangci-lint custom -v` to have logs).
|
||||||
- define the plugin inside the `linters-settings.custom` section with the type `module`.
|
- Define the plugin inside the `linters-settings.custom` section with the type `module`.
|
||||||
- run your custom version of golangci-lint
|
- Run your custom version of golangci-lint.
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
- Go
|
- Go
|
||||||
@ -47,11 +47,11 @@ linters:
|
|||||||
|
|
||||||
## The Manual Way
|
## The Manual Way
|
||||||
|
|
||||||
- add a blank-import of your module inside `cmd/golangci-lint/plugins.go`
|
- Add a blank-import of your module inside `cmd/golangci-lint/plugins.go`.
|
||||||
- run `go mod tidy`. (the module containing the plugin will be imported)
|
- Run `go mod tidy` (the module containing the plugin will be imported).
|
||||||
- run `make build`
|
- Run `make build`.
|
||||||
- define the plugin inside the configuration `linters-settings.custom` section with the type `module`.
|
- Define the plugin inside the configuration `linters-settings.custom` section with the type `module`.
|
||||||
- run your custom version of golangci-lint
|
- Run your custom version of golangci-lint.
|
||||||
|
|
||||||
### Configuration Example
|
### Configuration Example
|
||||||
|
|
||||||
|
@ -37,35 +37,35 @@ func NewBuilder(logger logutils.Log, cfg *Configuration, root string) *Builder {
|
|||||||
|
|
||||||
// Build builds the custom binary.
|
// Build builds the custom binary.
|
||||||
func (b Builder) Build(ctx context.Context) error {
|
func (b Builder) Build(ctx context.Context) error {
|
||||||
b.log.Infof("Cloning golangci-lint repository.")
|
b.log.Infof("Cloning golangci-lint repository")
|
||||||
|
|
||||||
err := b.clone(ctx)
|
err := b.clone(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("clone golangci-lint: %w", err)
|
return fmt.Errorf("clone golangci-lint: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.log.Infof("Adding plugin imports.")
|
b.log.Infof("Adding plugin imports")
|
||||||
|
|
||||||
err = b.updatePluginsFile()
|
err = b.updatePluginsFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("update plugin file: %w", err)
|
return fmt.Errorf("update plugin file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.log.Infof("Adding replace directives.")
|
b.log.Infof("Adding replace directives")
|
||||||
|
|
||||||
err = b.addReplaceDirectives(ctx)
|
err = b.addReplaceDirectives(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("add replace directives: %w", err)
|
return fmt.Errorf("add replace directives: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.log.Infof("Running go mod tidy.")
|
b.log.Infof("Running go mod tidy")
|
||||||
|
|
||||||
err = b.goModTidy(ctx)
|
err = b.goModTidy(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("go mod tidy: %w", err)
|
return fmt.Errorf("go mod tidy: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.log.Infof("Building golangci-lint binary.")
|
b.log.Infof("Building golangci-lint binary")
|
||||||
|
|
||||||
binaryName := b.getBinaryName()
|
binaryName := b.getBinaryName()
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ func (b Builder) Build(ctx context.Context) error {
|
|||||||
return fmt.Errorf("build golangci-lint binary: %w", err)
|
return fmt.Errorf("build golangci-lint binary: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.log.Infof("Moving golangci-lint binary.")
|
b.log.Infof("Moving golangci-lint binary")
|
||||||
|
|
||||||
err = b.copyBinary(binaryName)
|
err = b.copyBinary(binaryName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user