Skip to content

Commit

Permalink
fix: simplify golden files
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Feb 22, 2024
1 parent 096d08c commit 03ee51d
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions exp/golden/golden.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"flag"
"os"
"path/filepath"
"runtime"
"testing"

"github.com/aymanbagabas/go-udiff"
Expand All @@ -32,14 +31,6 @@ func RequireEqual(tb testing.TB, out []byte) {
}
}

path := filepath.Join(tb.TempDir(), tb.Name()+".out")
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { //nolint: gomnd
tb.Fatal(err)
}
if err := os.WriteFile(path, out, 0o600); err != nil { //nolint: gomnd
tb.Fatal(err)
}

goldenBts, err := os.ReadFile(golden)
if err != nil {
tb.Fatal(err)
Expand All @@ -53,8 +44,5 @@ func RequireEqual(tb testing.TB, out []byte) {
}

func fixLineEndings(in []byte) []byte {
if runtime.GOOS != "windows" {
return in
}
return bytes.ReplaceAll(in, []byte("\r\n"), []byte{'\n'})
}

0 comments on commit 03ee51d

Please sign in to comment.