Retire unused weather bundle persistence helpers
This commit is contained in:
@@ -3,7 +3,6 @@ package fileutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -74,11 +73,3 @@ func WriteFileAtomicContext(ctx context.Context, path string, data []byte) error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func WriteJSONAtomic(path string, value any) error {
|
||||
data, err := json.MarshalIndent(value, "", " ")
|
||||
if err != nil {
|
||||
return fmt.Errorf("marshal %q: %w", path, err)
|
||||
}
|
||||
return WriteFileAtomic(path, data)
|
||||
}
|
||||
|
||||
@@ -150,19 +150,3 @@ func TestWriteFileAtomicContextPreservesDestinationWhenCanceledAtPublication(t *
|
||||
t.Fatalf("temporary files/error = %v/%v", matches, globErr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteJSONAtomic(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "artifact.json")
|
||||
|
||||
if err := WriteJSONAtomic(path, map[string]string{"status": "ok"}); err != nil {
|
||||
t.Fatalf("WriteJSONAtomic() error = %v", err)
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatalf("ReadFile() error = %v", err)
|
||||
}
|
||||
if string(data) != "{\n \"status\": \"ok\"\n}" {
|
||||
t.Fatalf("json = %q, want indented object", data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user