Remove workspace state subsystem
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Package fileutil provides narrow filesystem helpers for durable artifacts.
|
||||
// Package fileutil provides narrow filesystem helpers for operator-owned outputs.
|
||||
package fileutil
|
||||
|
||||
import (
|
||||
@@ -38,11 +38,3 @@ func WriteJSONAtomic(path string, value any) error {
|
||||
}
|
||||
return WriteFileAtomic(path, data)
|
||||
}
|
||||
|
||||
func CopyFileAtomic(source string, target string) error {
|
||||
data, err := os.ReadFile(source)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read %q: %w", source, err)
|
||||
}
|
||||
return WriteFileAtomic(target, data)
|
||||
}
|
||||
|
||||
@@ -80,24 +80,3 @@ func TestWriteJSONAtomic(t *testing.T) {
|
||||
t.Fatalf("json = %q, want indented object", data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyFileAtomic(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
source := filepath.Join(dir, "source.txt")
|
||||
target := filepath.Join(dir, "nested", "target.txt")
|
||||
if err := os.WriteFile(source, []byte("copied"), 0o600); err != nil {
|
||||
t.Fatalf("WriteFile() error = %v", err)
|
||||
}
|
||||
|
||||
if err := CopyFileAtomic(source, target); err != nil {
|
||||
t.Fatalf("CopyFileAtomic() error = %v", err)
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(target)
|
||||
if err != nil {
|
||||
t.Fatalf("ReadFile() error = %v", err)
|
||||
}
|
||||
if string(data) != "copied" {
|
||||
t.Fatalf("data = %q, want copied", data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user