Fix linter warnings
This commit is contained in:
parent
56cef06332
commit
7f13496b6f
7
cache.go
7
cache.go
@ -4,6 +4,7 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
@ -47,12 +48,12 @@ func (self *cache) storeFile(context *Context, outputFile *File, inputFiles []*F
|
||||
}
|
||||
defer fp.Close()
|
||||
|
||||
offset, err := outputFile.Seek(0, os.SEEK_CUR)
|
||||
offset, err := outputFile.Seek(0, io.SeekCurrent)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := outputFile.Seek(0, os.SEEK_SET); err != nil {
|
||||
if _, err := outputFile.Seek(0, io.SeekStart); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -60,7 +61,7 @@ func (self *cache) storeFile(context *Context, outputFile *File, inputFiles []*F
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := outputFile.Seek(offset, os.SEEK_SET); err != nil {
|
||||
if _, err := outputFile.Seek(offset, io.SeekStart); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@ -31,7 +30,7 @@ type Context struct {
|
||||
|
||||
// CreateFileFrom data creates a new file instance from the provided data buffer.
|
||||
func (self *Context) CreateFileFromReader(sourcePath string, reader io.Reader) (*File, error) {
|
||||
data, err := ioutil.ReadAll(reader)
|
||||
data, err := io.ReadAll(reader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -146,7 +145,7 @@ func (self *Context) step() {
|
||||
defer wg.Done()
|
||||
for inputFile := range self.filesIn {
|
||||
if processor != nil && self.filtersInt.accept(inputFile) && self.filtersExt.accept(inputFile) {
|
||||
if _, err := inputFile.Seek(0, os.SEEK_SET); err != nil {
|
||||
if _, err := inputFile.Seek(0, io.SeekStart); err != nil {
|
||||
self.goldsmith.fault("core", inputFile, err)
|
||||
}
|
||||
if err := processor.Process(self, inputFile); err != nil {
|
||||
|
9
file.go
9
file.go
@ -3,7 +3,6 @@ package goldsmith
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@ -31,7 +30,7 @@ func (self *File) Rename(path string) {
|
||||
}
|
||||
|
||||
func (self *File) Rewrite(reader io.Reader) error {
|
||||
data, err := ioutil.ReadAll(reader)
|
||||
data, err := io.ReadAll(reader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -92,7 +91,7 @@ func (self *File) WriteTo(writer io.Writer) (int64, error) {
|
||||
|
||||
// Seek updates the file pointer to the desired position.
|
||||
func (self *File) Seek(offset int64, whence int) (int64, error) {
|
||||
if self.reader == nil && offset == 0 && (whence == os.SEEK_SET || whence == os.SEEK_CUR) {
|
||||
if self.reader == nil && offset == 0 && (whence == io.SeekStart || whence == io.SeekCurrent) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
@ -163,7 +162,7 @@ func (self *File) export(targetDir string) error {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if _, err := self.Seek(0, os.SEEK_SET); err != nil {
|
||||
if _, err := self.Seek(0, io.SeekStart); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -180,7 +179,7 @@ func (self *File) load() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadFile(self.dataPath)
|
||||
data, err := os.ReadFile(self.dataPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user