Skip to content

Commit

Permalink
docs: rename .golangci.example.yml to .golangci.reference.yml
Browse files Browse the repository at this point in the history
The name of this file leads many people to think that this file is an example configuration.
This file is a configuration reference: it contains the exhaustive configuration with explanations of the options.
This is not an example configuration.
  • Loading branch information
ldez committed May 15, 2022
1 parent e889b40 commit 60d5f81
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .golangci.example.yml → .golangci.reference.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# This file contains all available configuration options
# with their default values (in comments).
#
# This file is not a configuration example,
# it contains the exhaustive configuration with explanations of the options.

# Options for analysis running.
run:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/docs/contributing/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Just update it's version in `go.mod`.
## How to add configuration option to existing linter

Add a new field to a [config struct](https://github.com/golangci/golangci-lint/blob/master/pkg/config/config.go).
Document it in [.golangci.example.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml).
Document it in [.golangci.reference.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml).
Pass it to a linter.

## How to see `INFO` or `DEBUG` logs
Expand Down
4 changes: 2 additions & 2 deletions docs/src/docs/contributing/new-linters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ After that:
to the function `GetAllSupportedLinterConfigs`.
- Add `WithSince("next_version")`, where `next_version` must be replaced by the next minor version. (ex: v1.2.0 if the current version is v1.1.0)
4. Find out what options do you need to configure for the linter.
For example, `nakedret` has only 1 option: [`max-func-lines`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml).
For example, `nakedret` has only 1 option: [`max-func-lines`](https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml).
Choose default values to not being annoying for users of golangci-lint. Add configuration options to:
- [.golangci.example.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) - the example of a configuration file.
- [.golangci.reference.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml) - the example of a configuration file.
You can also add them to [.golangci.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.yml)
if you think that this project needs not default values.
- [config struct](https://github.com/golangci/golangci-lint/blob/master/pkg/config/config.go) -
Expand Down
2 changes: 1 addition & 1 deletion docs/src/docs/contributing/workflow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Which runs all the linters and tests.

## Create or update parameters for docs

Add your new or updated parameters to `.golangci.example.yml` so they will be shown in the docs
Add your new or updated parameters to `.golangci.reference.yml` so they will be shown in the docs

## Submit a pull request

Expand Down
2 changes: 1 addition & 1 deletion docs/src/docs/usage/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To see which config file is being used and where it was sourced from run golangc
Config options inside the file are identical to command-line options.
You can configure specific linters' options only within the config file (not the command-line).

There is a [`.golangci.example.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) file with all supported options, their description, and default values.
There is a [`.golangci.reference.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml) file with all supported options, their description, and default values.
This file is a neither a working example nor recommended configuration, it's just a reference to display all the configuration options.

{ .ConfigurationExample }
Expand Down
6 changes: 3 additions & 3 deletions scripts/expand_website_templates/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ func getLatestVersion() (string, error) {
}

func buildTemplateContext() (map[string]string, error) {
golangciYamlExample, err := os.ReadFile(".golangci.example.yml")
golangciYamlExample, err := os.ReadFile(".golangci.reference.yml")
if err != nil {
return nil, fmt.Errorf("can't read .golangci.example.yml: %w", err)
return nil, fmt.Errorf("can't read .golangci.reference.yml: %w", err)
}

snippets, err := extractExampleSnippets(golangciYamlExample)
if err != nil {
return nil, fmt.Errorf("can't read .golangci.example.yml: %w", err)
return nil, fmt.Errorf("can't read .golangci.reference.yml: %w", err)
}

if err = exec.Command("make", "build").Run(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion scripts/expand_website_templates/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func Test_extractExampleSnippets(t *testing.T) {
t.Skip("only for debugging purpose")

example, err := os.ReadFile("../../../golangci-lint/.golangci.example.yml")
example, err := os.ReadFile("../../../golangci-lint/.golangci.reference.yml")
require.NoError(t, err)

m, err := extractExampleSnippets(example)
Expand Down

0 comments on commit 60d5f81

Please sign in to comment.