fparams is a linter tool for Go that checks the formatting of function parameters and return values. The linter ensures that function parameters and return values are either all on one line or each on a new line. This helps maintain consistent and readable code formatting in Go projects.
- Parameter and return value checking: Verifies if function parameters and return values are formatted correctly.
- Configurable checks: Allows disabling checks for function parameters or return values through flags.
- Automated suggestions: Provides suggested fixes to format parameters and return values on separate lines if needed.
go install github.com/artemk1337/fparams/cmd/fparams@latest
fparams ./...
You can configure fparams using command-line flags to enable or disable specific checks:
-disableCheckFuncParams
- disable check function params-disableCheckFuncReturns
- disable check function returns
Given a function declaration like this:
func example(a int, b int,
c, d string) (int, error) {
return 0, nil
}
fparams will suggest changing it to:
func example(
a int,
b int,
c string,
d string,
) (
int,
error,
) {
return 0, nil
}
More valid and invalid examples see in testdata directory.
Run command to start test:
go test ./pkg/analyzer/...
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
By using fparams, you can ensure that your Go codebase remains clean and consistently formatted, making it easier to read and maintain.