Don't shadow builtins
This commit is contained in:
parent
7a01bd3b67
commit
2fa8b96843
3 changed files with 11 additions and 11 deletions
|
@ -93,12 +93,12 @@ func TestListAPI(t *testing.T) {
|
|||
// stat file in data/, use the first two bytes in the name
|
||||
// of the file as the size :)
|
||||
filename := req.URL.Path[6:]
|
||||
len, err := strconv.ParseInt(filename[:4], 16, 64)
|
||||
length, err := strconv.ParseInt(filename[:4], 16, 64)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
res.Header().Set("Content-Length", fmt.Sprintf("%d", len))
|
||||
res.Header().Set("Content-Length", fmt.Sprintf("%d", length))
|
||||
res.WriteHeader(http.StatusOK)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -68,21 +68,21 @@ func extractToFile(buf []byte, filename, target string, printf func(string, ...i
|
|||
|
||||
// Write everything to a temp file
|
||||
dir := filepath.Dir(target)
|
||||
new, err := os.CreateTemp(dir, "restic")
|
||||
newFile, err := os.CreateTemp(dir, "restic")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
n, err := io.Copy(new, rd)
|
||||
n, err := io.Copy(newFile, rd)
|
||||
if err != nil {
|
||||
_ = new.Close()
|
||||
_ = os.Remove(new.Name())
|
||||
_ = newFile.Close()
|
||||
_ = os.Remove(newFile.Name())
|
||||
return err
|
||||
}
|
||||
if err = new.Sync(); err != nil {
|
||||
if err = newFile.Sync(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = new.Close(); err != nil {
|
||||
if err = newFile.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ func extractToFile(buf []byte, filename, target string, printf func(string, ...i
|
|||
}
|
||||
|
||||
// Rename the temp file to the final location atomically.
|
||||
if err := os.Rename(new.Name(), target); err != nil {
|
||||
if err := os.Rename(newFile.Name(), target); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -177,10 +177,10 @@ func (t *Table) Write(w io.Writer) error {
|
|||
|
||||
// write all the lines
|
||||
for i, line := range lines {
|
||||
print := func(w io.Writer, s string) error {
|
||||
printer := func(w io.Writer, s string) error {
|
||||
return t.PrintData(w, i, s)
|
||||
}
|
||||
err := printLine(w, print, t.CellSeparator, line, columnWidths)
|
||||
err := printLine(w, printer, t.CellSeparator, line, columnWidths)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue