- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 21 for DirFS (0.09 sec)
-
src/io/fs/glob_test.go
"path" "slices" "strings" "testing" ) var globTests = []struct { fs FS pattern, result string }{ {os.DirFS("."), "glob.go", "glob.go"}, {os.DirFS("."), "gl?b.go", "glob.go"}, {os.DirFS("."), `gl\ob.go`, "glob.go"}, {os.DirFS("."), "*", "glob.go"}, {os.DirFS(".."), "*/glob.go", "fs/glob.go"}, } func TestGlob(t *testing.T) { for _, tt := range globTests {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 07 18:36:52 UTC 2024 - 2.3K bytes - Viewed (0) -
src/os/file.go
// [io/fs.ReadDirFS]. func DirFS(dir string) fs.FS { return dirFS(dir) } type dirFS string func (dir dirFS) Open(name string) (fs.File, error) { fullname, err := dir.join(name) if err != nil { return nil, &PathError{Op: "open", Path: name, Err: err} } f, err := Open(fullname) if err != nil { // DirFS takes a string appropriate for GOOS,
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Apr 26 23:07:37 UTC 2024 - 25.4K bytes - Viewed (0) -
src/cmd/relnote/relnote_test.go
if !*flagCheck { t.Skip("-check not specified") } root := testenv.GOROOT(t) rootFS := os.DirFS(root) files, err := fs.Glob(rootFS, "api/next/*.txt") if err != nil { t.Fatal(err) } t.Logf("checking release notes for %d files in api/next", len(files)) docFS := os.DirFS(filepath.Join(root, "doc", "next")) // Check that each api/next file has a corresponding release note fragment.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Feb 05 16:31:53 UTC 2024 - 1K bytes - Viewed (0) -
src/io/fs/sub.go
// // Note that Sub(os.DirFS("/"), "prefix") is equivalent to os.DirFS("/prefix") // and that neither of them guarantees to avoid operating system // accesses outside "/prefix", because the implementation of [os.DirFS] // does not check for symbolic links inside "/prefix" that point to // other directories. That is, [os.DirFS] is not a general substitute for a
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sat Feb 10 02:10:17 UTC 2024 - 3.6K bytes - Viewed (0) -
src/os/os_test.go
// Test that Open can open a path starting at /. d := DirFS("/") f, err := d.Open(cwd + "/testdata/dirfs/a") if err != nil { t.Fatal(err) } f.Close() } func TestDirFSEmptyDir(t *testing.T) { t.Parallel() d := DirFS("") cwd, _ := Getwd() for _, path := range []string{ "testdata/dirfs/a", // not DirFS(".")
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 83.1K bytes - Viewed (0) -
src/io/fs/readfile_test.go
if string(data) != "hello, world" || err != nil { t.Fatalf(`ReadFile(sub(.), "hello.txt") = %q, %v, want %q, nil`, data, err, "hello, world") } } func TestReadFilePath(t *testing.T) { fsys := os.DirFS(t.TempDir()) _, err1 := ReadFile(fsys, "non-existent") _, err2 := ReadFile(struct{ FS }{fsys}, "non-existent") if s1, s2 := errorPath(err1), errorPath(err2); s1 != s2 { t.Fatalf("s1: %s != s2: %s", s1, s2) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Nov 27 16:25:41 UTC 2023 - 1.8K bytes - Viewed (0) -
manifests/manifest.go
var FS embed.FS // BuiltinOrDir returns a FS for the provided directory. If no directory is passed, the compiled in // FS will be used func BuiltinOrDir(dir string) fs.FS { if dir == "" { return FS } return os.DirFS(dir)
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Wed Mar 15 02:30:16 UTC 2023 - 935 bytes - Viewed (0) -
src/testing/fstest/testfs_test.go
"errors" "internal/testenv" "io/fs" "os" "path/filepath" "slices" "strings" "testing" ) func TestSymlink(t *testing.T) { testenv.MustHaveSymlink(t) tmp := t.TempDir() tmpfs := os.DirFS(tmp) if err := os.WriteFile(filepath.Join(tmp, "hello"), []byte("hello, world\n"), 0644); err != nil { t.Fatal(err) } if err := os.Symlink(filepath.Join(tmp, "hello"), filepath.Join(tmp, "hello.link")); err != nil {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 2.9K bytes - Viewed (0) -
src/io/fs/walk_test.go
} } bad := filepath.Join(dir, "a", "bad") if err := os.Chmod(bad, 0); err != nil { t.Fatal(err) } defer os.Chmod(bad, 0700) // avoid errors on cleanup var saw []string err := WalkDir(os.DirFS(dir), ".", func(path string, d DirEntry, err error) error { if err != nil { return filepath.SkipDir } if d.IsDir() { saw = append(saw, path) } return nil }) if err != nil {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Nov 18 15:21:18 UTC 2022 - 3K bytes - Viewed (0) -
src/io/fs/readdir_test.go
}) } } func errorPath(err error) string { var perr *PathError if !errors.As(err, &perr) { return "" } return perr.Path } func TestReadDirPath(t *testing.T) { fsys := os.DirFS(t.TempDir()) _, err1 := ReadDir(fsys, "non-existent") _, err2 := ReadDir(struct{ FS }{fsys}, "non-existent") if s1, s2 := errorPath(err1), errorPath(err2); s1 != s2 { t.Fatalf("s1: %s != s2: %s", s1, s2) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Nov 27 16:25:41 UTC 2023 - 2.6K bytes - Viewed (0)