Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 23 for DirFS (0.03 sec)

  1. 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)
  2. 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)
  3. src/net/http/filetransport.go

    // incoming requests, as well as most other properties of the
    // request.
    //
    // The typical use case for NewFileTransportFS is to register the "file"
    // protocol with a [Transport], as in:
    //
    //	fsys := os.DirFS("/")
    //	t := &http.Transport{}
    //	t.RegisterProtocol("file", http.NewFileTransportFS(fsys))
    //	c := &http.Client{Transport: t}
    //	res, err := c.Get("file:///etc/passwd")
    //	...
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 10 03:29:50 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  4. src/net/http/http_test.go

    func TestNoUnicodeStrings(t *testing.T) {
    	if !testenv.HasSrc() {
    		t.Skip("source code not available")
    	}
    
    	re := regexp.MustCompile(`(strings|bytes).([A-Za-z]+)`)
    	if err := fs.WalkDir(os.DirFS("."), ".", func(path string, d fs.DirEntry, err error) error {
    		if err != nil {
    			t.Fatal(err)
    		}
    
    		if path == "internal/ascii" {
    			return fs.SkipDir
    		}
    		if !strings.HasSuffix(path, ".go") ||
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 22 18:18:19 UTC 2023
    - 5.2K bytes
    - Viewed (0)
  5. src/cmd/distpack/archive.go

    // The archive can be amended afterward using methods like Add and Filter.
    func NewArchive(dir string) (*Archive, error) {
    	a := new(Archive)
    	err := fs.WalkDir(os.DirFS(dir), ".", func(name string, d fs.DirEntry, err error) error {
    		if err != nil {
    			return err
    		}
    		if d.IsDir() {
    			return nil
    		}
    		info, err := d.Info()
    		if err != nil {
    			return err
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Aug 11 17:37:52 UTC 2023
    - 5.9K bytes
    - Viewed (0)
  6. cni/pkg/nodeagent/server.go

    		return nil, fmt.Errorf("error initializing the host rules for health checks: %w", err)
    	}
    
    	podNetns := NewPodNetnsProcFinder(os.DirFS(filepath.Join(pconstants.HostMountsPath, "proc")))
    	netServer := newNetServer(ztunnelServer, podNsMap, iptablesConfigurator, podNetns, set)
    
    	// Set some defaults
    	s := &Server{
    		ctx:        ctx,
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 31 21:45:18 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  7. src/html/template/multi_test.go

    	_, err = template.ParseGlob("testdata/file*.tmpl")
    	if err != nil {
    		t.Fatalf("error parsing files: %v", err)
    	}
    	testExecute(multiExecTests, template, t)
    }
    
    func TestParseFS(t *testing.T) {
    	fs := os.DirFS("testdata")
    
    	{
    		_, err := ParseFS(fs, "DOES NOT EXIST")
    		if err == nil {
    			t.Error("expected error for non-existent file; got none")
    		}
    	}
    
    	{
    		template := New("root")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 06 15:48:16 UTC 2022
    - 8K bytes
    - Viewed (0)
  8. src/text/template/multi_test.go

    	_, err = template.ParseGlob("testdata/file*.tmpl")
    	if err != nil {
    		t.Fatalf("error parsing files: %v", err)
    	}
    	testExecute(multiExecTests, template, t)
    }
    
    func TestParseFS(t *testing.T) {
    	fs := os.DirFS("testdata")
    
    	{
    		_, err := ParseFS(fs, "DOES NOT EXIST")
    		if err == nil {
    			t.Error("expected error for non-existent file; got none")
    		}
    	}
    
    	{
    		template := New("root")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Sep 08 10:48:29 UTC 2022
    - 11.7K bytes
    - Viewed (0)
  9. src/net/http/fs_test.go

    	for i := 0; i < 2; i++ {
    		var h Handler
    		var name string
    		switch i {
    		case 0:
    			h = FileServer(Dir("."))
    			name = "Dir"
    		case 1:
    			h = FileServer(FS(os.DirFS(".")))
    			name = "DirFS"
    		}
    		t.Run(name, func(t *testing.T) {
    			const want = "index.html says hello\n"
    			ts := newClientServerTest(t, mode, h).ts
    
    			for _, path := range []string{"/testdata/", "/testdata/index.html"} {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 23:39:44 UTC 2024
    - 49.9K bytes
    - Viewed (0)
  10. src/os/removeall_test.go

    	}
    }
    
    func BenchmarkRemoveAll(b *testing.B) {
    	tmpDir := filepath.Join(b.TempDir(), "target")
    	b.ReportAllocs()
    	b.ResetTimer()
    	for i := 0; i < b.N; i++ {
    		b.StopTimer()
    		err := CopyFS(tmpDir, DirFS("."))
    		if err != nil {
    			b.Fatal(err)
    		}
    		b.StartTimer()
    		if err := RemoveAll(tmpDir); err != nil {
    			b.Fatal(err)
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:21:29 UTC 2024
    - 12.3K bytes
    - Viewed (0)
Back to top