lib/fs: Use os.FileMode.String for fs.FileMode (#5302)

This commit is contained in:
Simon Frei 2018-10-31 12:49:50 +01:00 committed by Jakob Borg
parent 830bde2c83
commit 53b0f36be6
2 changed files with 12 additions and 0 deletions

View File

@ -79,6 +79,10 @@ type FileInfo interface {
// FileMode is similar to os.FileMode // FileMode is similar to os.FileMode
type FileMode uint32 type FileMode uint32
func (fm FileMode) String() string {
return os.FileMode(fm).String()
}
// Usage represents filesystem space usage // Usage represents filesystem space usage
type Usage struct { type Usage struct {
Free int64 Free int64

View File

@ -98,3 +98,11 @@ func TestCanonicalize(t *testing.T) {
} }
} }
} }
func TestFileModeString(t *testing.T) {
var fm FileMode = 0777
exp := "-rwxrwxrwx"
if fm.String() != exp {
t.Fatalf("Got %v, expected %v", fm.String(), exp)
}
}