diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-09-13 11:36:54 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-09-13 11:47:28 +0200 |
commit | cb548fedb8668be2cdd18d310ef77e1fef8c5fcb (patch) | |
tree | b81f3660d8d1898e835e0779cfa4badea4537e0b /repo.go | |
parent | e8b48ddece267bfde7c0565a8ec39fd5b53cee72 (diff) | |
download | dna-backup-cb548fedb8668be2cdd18d310ef77e1fef8c5fcb.tar.gz dna-backup-cb548fedb8668be2cdd18d310ef77e1fef8c5fcb.zip |
fix golint ci errors
Diffstat (limited to 'repo.go')
-rw-r--r-- | repo.go | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -28,7 +28,6 @@ import ( "bufio" "bytes" "encoding/gob" - "errors" "fmt" "hash" "io" @@ -72,9 +71,9 @@ type File struct { func NewRepo(path string) *Repo { err := os.MkdirAll(path, 0775) - // if err != nil { - // log.Panicln(err) - // } + if err != nil { + log.Panicln(err) + } var seed int64 = 1 p, err := rabinkarp64.RandomPolynomial(seed) if err != nil { @@ -244,18 +243,18 @@ func (r *Repo) StoreChunkContent(id *ChunkId, reader io.Reader) error { path := id.Path(r.path) file, err := os.Create(path) if err != nil { - return errors.New(fmt.Sprintf("Error creating chunk for '%s'; %s\n", path, err)) + return fmt.Errorf("Error creating chunk for '%s'; %s\n", path, err) } wrapper := r.chunkWriteWrapper(file) n, err := io.Copy(wrapper, reader) if err != nil { - return errors.New(fmt.Sprintf("Error writing chunk content for '%s', written %d bytes: %s\n", path, n, err)) + return fmt.Errorf("Error writing chunk content for '%s', written %d bytes: %s\n", path, n, err) } if err := wrapper.Close(); err != nil { - return errors.New(fmt.Sprintf("Error closing write wrapper for '%s': %s\n", path, err)) + return fmt.Errorf("Error closing write wrapper for '%s': %s\n", path, err) } if err := file.Close(); err != nil { - return errors.New(fmt.Sprintf("Error closing chunk for '%s': %s\n", path, err)) + return fmt.Errorf("Error closing chunk for '%s': %s\n", path, err) } return nil } |