remove pointless interface
This commit is contained in:
parent
a7b14cc12c
commit
d0ca09b7d1
@ -5,20 +5,16 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Writer interface {
|
type Writer struct {
|
||||||
io.WriteSeeker
|
|
||||||
}
|
|
||||||
|
|
||||||
type writer struct {
|
|
||||||
data []byte
|
data []byte
|
||||||
offset int
|
offset int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWriter(data []byte) Writer {
|
func NewWriter(data []byte) *Writer {
|
||||||
return &writer{data, 0}
|
return &Writer{data, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *writer) Write(data []byte) (int, error) {
|
func (w *Writer) Write(data []byte) (int, error) {
|
||||||
length := len(data)
|
length := len(data)
|
||||||
if w.offset+length > len(w.data) {
|
if w.offset+length > len(w.data) {
|
||||||
length = len(w.data) - w.offset
|
length = len(w.data) - w.offset
|
||||||
@ -34,7 +30,7 @@ func (w *writer) Write(data []byte) (int, error) {
|
|||||||
return length, nil
|
return length, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *writer) Seek(offset int64, whence int) (int64, error) {
|
func (w *Writer) Seek(offset int64, whence int) (int64, error) {
|
||||||
result := w.offset
|
result := w.offset
|
||||||
switch whence {
|
switch whence {
|
||||||
case io.SeekStart:
|
case io.SeekStart:
|
||||||
|
Loading…
Reference in New Issue
Block a user