1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-21 23:33:03 +00:00

fs: Remove explicit type check in extendedStat

Without comma-ok, the runtime inserts the same check with a similar
enough panic message:

    interface conversion: interface {} is nil, not *syscall.Stat_t
This commit is contained in:
greatroar 2022-11-12 11:40:15 +01:00
parent 05cebc1c4b
commit 60aa87bbab
2 changed files with 2 additions and 10 deletions

View file

@ -4,7 +4,6 @@
package fs
import (
"fmt"
"os"
"syscall"
"time"
@ -12,10 +11,7 @@ import (
// extendedStat extracts info into an ExtendedFileInfo for unix based operating systems.
func extendedStat(fi os.FileInfo) ExtendedFileInfo {
s, ok := fi.Sys().(*syscall.Stat_t)
if !ok {
panic(fmt.Sprintf("conversion to syscall.Stat_t failed, type is %T", fi.Sys()))
}
s := fi.Sys().(*syscall.Stat_t)
extFI := ExtendedFileInfo{
FileInfo: fi,

View file

@ -4,7 +4,6 @@
package fs
import (
"fmt"
"os"
"syscall"
"time"
@ -12,10 +11,7 @@ import (
// extendedStat extracts info into an ExtendedFileInfo for unix based operating systems.
func extendedStat(fi os.FileInfo) ExtendedFileInfo {
s, ok := fi.Sys().(*syscall.Stat_t)
if !ok {
panic(fmt.Sprintf("conversion to syscall.Stat_t failed, type is %T", fi.Sys()))
}
s := fi.Sys().(*syscall.Stat_t)
extFI := ExtendedFileInfo{
FileInfo: fi,