mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +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
@ -4,7 +4,6 @@
|
|||||||
package fs
|
package fs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@ -12,10 +11,7 @@ import (
|
|||||||
|
|
||||||
// extendedStat extracts info into an ExtendedFileInfo for unix based operating systems.
|
// extendedStat extracts info into an ExtendedFileInfo for unix based operating systems.
|
||||||
func extendedStat(fi os.FileInfo) ExtendedFileInfo {
|
func extendedStat(fi os.FileInfo) ExtendedFileInfo {
|
||||||
s, ok := fi.Sys().(*syscall.Stat_t)
|
s := fi.Sys().(*syscall.Stat_t)
|
||||||
if !ok {
|
|
||||||
panic(fmt.Sprintf("conversion to syscall.Stat_t failed, type is %T", fi.Sys()))
|
|
||||||
}
|
|
||||||
|
|
||||||
extFI := ExtendedFileInfo{
|
extFI := ExtendedFileInfo{
|
||||||
FileInfo: fi,
|
FileInfo: fi,
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
package fs
|
package fs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@ -12,10 +11,7 @@ import (
|
|||||||
|
|
||||||
// extendedStat extracts info into an ExtendedFileInfo for unix based operating systems.
|
// extendedStat extracts info into an ExtendedFileInfo for unix based operating systems.
|
||||||
func extendedStat(fi os.FileInfo) ExtendedFileInfo {
|
func extendedStat(fi os.FileInfo) ExtendedFileInfo {
|
||||||
s, ok := fi.Sys().(*syscall.Stat_t)
|
s := fi.Sys().(*syscall.Stat_t)
|
||||||
if !ok {
|
|
||||||
panic(fmt.Sprintf("conversion to syscall.Stat_t failed, type is %T", fi.Sys()))
|
|
||||||
}
|
|
||||||
|
|
||||||
extFI := ExtendedFileInfo{
|
extFI := ExtendedFileInfo{
|
||||||
FileInfo: fi,
|
FileInfo: fi,
|
||||||
|
Loading…
Reference in New Issue
Block a user