gofumpt
This commit is contained in:
@@ -44,7 +44,7 @@ func Build(markdownPath, templatePath, outputPath string) error {
|
|||||||
output = strings.Replace(output, r.old, r.new, 1)
|
output = strings.Replace(output, r.old, r.new, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.WriteFile(outputPath, []byte(output), 0644); err != nil {
|
if err := os.WriteFile(outputPath, []byte(output), 0o644); err != nil {
|
||||||
return fmt.Errorf("write output: %w", err)
|
return fmt.Errorf("write output: %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func TestBuild(t *testing.T) {
|
|||||||
|
|
||||||
md := "# Test List\n\n- [Example](https://example.com) - A test entry.\n"
|
md := "# Test List\n\n- [Example](https://example.com) - A test entry.\n"
|
||||||
mdPath := filepath.Join(dir, "README.md")
|
mdPath := filepath.Join(dir, "README.md")
|
||||||
if err := os.WriteFile(mdPath, []byte(md), 0644); err != nil {
|
if err := os.WriteFile(mdPath, []byte(md), 0o644); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ func TestBuild(t *testing.T) {
|
|||||||
</body>
|
</body>
|
||||||
</html>`
|
</html>`
|
||||||
tmplPath := filepath.Join(dir, "template.html")
|
tmplPath := filepath.Join(dir, "template.html")
|
||||||
if err := os.WriteFile(tmplPath, []byte(tmpl), 0644); err != nil {
|
if err := os.WriteFile(tmplPath, []byte(tmpl), 0o644); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ func TestBuildWithSectionPlaceholder(t *testing.T) {
|
|||||||
|
|
||||||
md := "# Hello\n\nWorld.\n"
|
md := "# Hello\n\nWorld.\n"
|
||||||
mdPath := filepath.Join(dir, "README.md")
|
mdPath := filepath.Join(dir, "README.md")
|
||||||
if err := os.WriteFile(mdPath, []byte(md), 0644); err != nil {
|
if err := os.WriteFile(mdPath, []byte(md), 0o644); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ func TestBuildWithSectionPlaceholder(t *testing.T) {
|
|||||||
</body>
|
</body>
|
||||||
</html>`
|
</html>`
|
||||||
tmplPath := filepath.Join(dir, "template.html")
|
tmplPath := filepath.Join(dir, "template.html")
|
||||||
if err := os.WriteFile(tmplPath, []byte(tmpl), 0644); err != nil {
|
if err := os.WriteFile(tmplPath, []byte(tmpl), 0o644); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
internal/cache/cache.go
vendored
2
internal/cache/cache.go
vendored
@@ -76,7 +76,7 @@ func SaveHealthCache(path string, hc *HealthCache) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return os.WriteFile(path, data, 0644)
|
return os.WriteFile(path, data, 0o644)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge updates the cache with new entries, replacing existing ones by URL.
|
// Merge updates the cache with new entries, replacing existing ones by URL.
|
||||||
|
|||||||
4
internal/cache/cache_test.go
vendored
4
internal/cache/cache_test.go
vendored
@@ -14,7 +14,7 @@ func TestLoadExcludeList(t *testing.T) {
|
|||||||
- https://example.com
|
- https://example.com
|
||||||
- https://test.org
|
- https://test.org
|
||||||
`
|
`
|
||||||
if err := os.WriteFile(path, []byte(content), 0644); err != nil {
|
if err := os.WriteFile(path, []byte(content), 0o644); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ func TestLoadHealthCacheMissing(t *testing.T) {
|
|||||||
func TestLoadHealthCacheInvalidYAML(t *testing.T) {
|
func TestLoadHealthCacheInvalidYAML(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
path := filepath.Join(dir, "health.yaml")
|
path := filepath.Join(dir, "health.yaml")
|
||||||
if err := os.WriteFile(path, []byte("entries:\n - url: [not yaml"), 0644); err != nil {
|
if err := os.WriteFile(path, []byte("entries:\n - url: [not yaml"), 0o644); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,8 @@ func Parse(r io.Reader) (Document, error) {
|
|||||||
func buildTree(flat []struct {
|
func buildTree(flat []struct {
|
||||||
section Section
|
section Section
|
||||||
level int
|
level int
|
||||||
}) []Section {
|
},
|
||||||
|
) []Section {
|
||||||
if len(flat) == 0 {
|
if len(flat) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user