implements lstat and fixes inode stat on windows go 1.20 (#1168)
gojs: implements lstat This implements platform.Lstat and uses it in GOOS=js. Notably, directory listings need to run lstat on their entries to get the correct inodes back. In GOOS=js, directories are a fan-out of names, then lstat. This also fixes stat for inodes on directories. We were missing a test so we didn't know it was broken on windows. The approach used now is reliable on go 1.20, and we should suggest anyone using windows to compile with go 1.20. Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
@@ -45,6 +45,18 @@ func TestDirFS_String(t *testing.T) {
|
||||
require.Equal(t, ".", testFS.String())
|
||||
}
|
||||
|
||||
func TestDirFS_Lstat(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
require.NoError(t, fstest.WriteTestFiles(tmpDir))
|
||||
|
||||
testFS := NewDirFS(tmpDir)
|
||||
for _, path := range []string{"animals.txt", "sub", "sub-link"} {
|
||||
require.NoError(t, testFS.Symlink(path, path+"-link"))
|
||||
}
|
||||
|
||||
testLstat(t, testFS)
|
||||
}
|
||||
|
||||
func TestDirFS_MkDir(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
testFS := NewDirFS(tmpDir)
|
||||
|
||||
Reference in New Issue
Block a user