Skip to content

Add support for SuggestedFixes #1779

Closed
@ldez

Description

@ldez

Is your feature request related to a problem? Please describe.

Add support for SuggestedFixes.

https://github.com/golang/tools/blob/b4639ccb830b1c9602f1c96eba624bbbe20650ea/go/analysis/doc/suggested_fixes.md

Describe the solution you'd like

Be able to apply automatically the fixes via --fix.

Describe alternatives you've considered

Display the suggestion as extra information.

Additional context

type Diagnostic struct {
	// ...

	// SuggestedFixes contains suggested fixes for a diagnostic which can be used to perform
	// edits to a file that address the diagnostic.
	// TODO(matloob): Should multiple SuggestedFixes be allowed for a diagnostic?
	// Diagnostics should not contain SuggestedFixes that overlap.
	// Experimental: This API is experimental and may change in the future.
	SuggestedFixes []SuggestedFix // optional


	// ...
}

https://github.com/golang/tools/blob/b4639ccb830b1c9602f1c96eba624bbbe20650ea/go/analysis/diagnostic.go#L23-L28

Current linters that support SuggestedFixes:

  • goerr113
  • ruleguard
  • staticcheck
  • nlreturn
  • exportloopref
  • exhaustive
  • govet

Related to #1728

If you want to help me:

Latest update: #1779 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions