Skip to content

Commit 7834dc4

Browse files
committed
Change lidia write to accept interface
1 parent 58e32e1 commit 7834dc4

6 files changed

+2
-359817
lines changed

lidia/format.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/binary"
66
"hash/crc32"
77
"io"
8-
"os"
98
)
109

1110
type stringOffset uint64
@@ -131,7 +130,7 @@ func readFields8(entryBuf []byte) rangeEntry {
131130
}
132131
}
133132

134-
func (rc *rangeCollector) write(f *os.File) error {
133+
func (rc *rangeCollector) write(f io.WriteSeeker) error {
135134
buf := bufio.NewWriter(f)
136135
hdr := &header{
137136
version: version,

lidia/lidia.go

+1-7
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,7 @@ func CreateLidiaFromELF(elfFile *elf.File, output io.WriteSeeker, opts ...Option
182182

183183
rb.sort()
184184

185-
// Cast to *os.File to use the write method
186-
outputFile, ok := output.(*os.File)
187-
if !ok {
188-
return fmt.Errorf("output must be an *os.File")
189-
}
190-
191-
err = rc.write(outputFile)
185+
err = rc.write(output)
192186
if err != nil {
193187
return fmt.Errorf("failed to write lidia file: %w", err)
194188
}

0 commit comments

Comments
 (0)