Skip to content

Commit 8c029f0

Browse files
committed
feat: rewrite expand_templates
1 parent 1e46b51 commit 8c029f0

File tree

8 files changed

+173
-407
lines changed

8 files changed

+173
-407
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ If you value it, consider supporting us, we appreciate it!
66

77
[![Donate](https://img.shields.io/badge/Donate-❤️-blue?style=for-the-badge)](https://donate.golangci.org)
88

9+
<!-- START --->
10+
911
### v2.3.1
1012

1113
1. Linters bug fixes
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
ConfigurationFile.md
2+
ConfigurationFile.json
23
FormattersSettings.md
4+
FormattersSettings.json
35
LintersSettings.md
6+
LintersSettings.json
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package main
2+
3+
import (
4+
"bufio"
5+
"bytes"
6+
"os"
7+
"path/filepath"
8+
)
9+
10+
func copyChangelog(dir string) error {
11+
marker := "<!-- START --->"
12+
13+
in, err := os.ReadFile("CHANGELOG.md")
14+
if err != nil {
15+
return err
16+
}
17+
18+
out, err := os.Create(filepath.Join(dir, "raw_changelog.tmp"))
19+
if err != nil {
20+
return err
21+
}
22+
23+
defer func() { _ = out.Close() }()
24+
25+
var write bool
26+
27+
// TODO(ldez): use bytes.Lines when min go1.24 (and remove the new line)
28+
scanner := bufio.NewScanner(bytes.NewBuffer(bytes.ReplaceAll(in, []byte("### "), []byte("## "))))
29+
scanner.Split(bufio.ScanLines)
30+
31+
for scanner.Scan() {
32+
line := scanner.Bytes()
33+
34+
if bytes.Equal(bytes.TrimSpace(line), []byte(marker)) {
35+
write = true
36+
continue
37+
}
38+
39+
if !write {
40+
continue
41+
}
42+
43+
line = append(line, '\n')
44+
45+
_, err = out.Write(line)
46+
if err != nil {
47+
return err
48+
}
49+
}
50+
51+
return nil
52+
}

scripts/website/expand_templates/exclusions.go

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)