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:
parent
05cebc1c4b
commit
60aa87bbab
2 changed files with 2 additions and 10 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue