file-util.go: corretta l'iniziale dei mesaggi d'errore (dev'essere minuscola)
This commit is contained in:
parent
269f30b2ed
commit
da3dc390c3
10
file-util.go
10
file-util.go
@ -95,23 +95,23 @@ func MoveFile(sourcePath, destPath string) (int64, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
inputFile, err := os.Open(sourcePath)
|
inputFile, err := os.Open(sourcePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("Couldn't open source file: %s", err)
|
return 0, fmt.Errorf("couldn't open source file: %s", err)
|
||||||
}
|
}
|
||||||
outputFile, err := os.Create(destPath)
|
outputFile, err := os.Create(destPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
inputFile.Close()
|
inputFile.Close()
|
||||||
return 0, fmt.Errorf("Couldn't open dest file: %s", err)
|
return 0, fmt.Errorf("couldn't open dest file: %s", err)
|
||||||
}
|
}
|
||||||
defer outputFile.Close()
|
defer outputFile.Close()
|
||||||
size, err = io.Copy(outputFile, inputFile)
|
size, err = io.Copy(outputFile, inputFile)
|
||||||
inputFile.Close()
|
inputFile.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("Writing to output file failed: %s", err)
|
return 0, fmt.Errorf("failed writing to output file: %s", err)
|
||||||
}
|
}
|
||||||
// The copy was successful, so now delete the original file
|
// The copy was successful, so now delete the original file
|
||||||
err = os.Remove(sourcePath)
|
err = os.Remove(sourcePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("Failed removing original file: %s", err)
|
return 0, fmt.Errorf("failed removing original file: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return size, nil
|
return size, nil
|
||||||
@ -136,7 +136,7 @@ func ParseMemSize(s string) (size int64, err error) {
|
|||||||
size, err = strconv.ParseInt(s, 10, 64)
|
size, err = strconv.ParseInt(s, 10, 64)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = errors.New("Empty string")
|
err = errors.New("empty string")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user