Skip to content

docs: improve version documentation #5639

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

Merged
merged 1 commit into from
Mar 26, 2025
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
2 changes: 2 additions & 0 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# This file is not a configuration example,
# it contains the exhaustive configuration with explanations of the options.

# Defines the configuration version.
# The only possible value is "2".
version: "2"

linters:
Expand Down
2 changes: 2 additions & 0 deletions .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# This file is not a configuration example,
# it contains the exhaustive configuration with explanations of the options.

# Defines the configuration version.
# The only possible value is "2".
version: "2"

linters:
Expand Down
8 changes: 0 additions & 8 deletions docs/src/docs/usage/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ The configuration file can be validated with the JSON Schema: https://golangci-l

{ .ConfigurationExample }

### `version` configuration

```yaml
# Defines the configuration version.
# The only possible value is "2".
version: "2"
```

## Command-Line Options

### run
Expand Down
19 changes: 13 additions & 6 deletions scripts/website/expand_templates/linters.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ type ExampleSnippetsExtractor struct {

func NewExampleSnippetsExtractor() *ExampleSnippetsExtractor {
return &ExampleSnippetsExtractor{
// TODO(ldez) replace .golangci.next.reference.yml by .golangci.reference.yml
referencePath: ".golangci.next.reference.yml",
referencePath: ".golangci.reference.yml",
assetsPath: "assets",
}
}
Expand Down Expand Up @@ -281,11 +280,19 @@ func (e *ExampleSnippetsExtractor) extractExampleSnippets(example []byte) (*Sett
}

if node.Value == "version" {
node.HeadComment = `See the dedicated "version" documentation section.`
newNode = nextNode
}
n := &yaml.Node{
HeadComment: fmt.Sprintf("See the dedicated %q documentation section.", node.Value),
Kind: node.Kind,
Style: node.Style,
Tag: node.Tag,
Value: node.Value,
Content: node.Content,
}

globalNode.Content = append(globalNode.Content, node, newNode)
globalNode.Content = append(globalNode.Content, n, nextNode)
} else {
globalNode.Content = append(globalNode.Content, node, newNode)
}

if node.Value == keyLinters || node.Value == keyFormatters {
for i := 0; i < len(nextNode.Content); i++ {
Expand Down
Loading