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)
|
||||
}
|
||||
|
||||
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 nil
|
||||
|
||||
@@ -12,7 +12,7 @@ func TestBuild(t *testing.T) {
|
||||
|
||||
md := "# Test List\n\n- [Example](https://example.com) - A test entry.\n"
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ func TestBuild(t *testing.T) {
|
||||
</body>
|
||||
</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)
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func TestBuildWithSectionPlaceholder(t *testing.T) {
|
||||
|
||||
md := "# Hello\n\nWorld.\n"
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ func TestBuildWithSectionPlaceholder(t *testing.T) {
|
||||
</body>
|
||||
</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)
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
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.
|
||||
|
||||
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://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)
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ func TestLoadHealthCacheMissing(t *testing.T) {
|
||||
func TestLoadHealthCacheInvalidYAML(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,8 @@ func Parse(r io.Reader) (Document, error) {
|
||||
func buildTree(flat []struct {
|
||||
section Section
|
||||
level int
|
||||
}) []Section {
|
||||
},
|
||||
) []Section {
|
||||
if len(flat) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user