Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 23 for DirFS (0.12 sec)

  1. 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)
  2. 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)
  3. 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)
  4. operator/pkg/helm/fs_renderer_test.go

    			startRender: true,
    			objFileTemplateReader: Renderer{
    				namespace:     "name-space",
    				componentName: "foo-component",
    				dir:           "testdata/render",
    				files:         os.DirFS("."),
    			},
    			wantResult: `apiVersion: v1
    description: test
    name: addon
    version: 1.1.0
    appVersion: 1.1.0
    tillerVersion: ">=2.7.2"
    keywords:
      - istio-addon
    
    ---
    `,
    			wantErr: nil,
    		},
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Feb 24 21:09:19 UTC 2021
    - 2.8K bytes
    - Viewed (0)
  5. 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)
  6. src/io/fs/example_test.go

    // license that can be found in the LICENSE file.
    
    package fs_test
    
    import (
    	"fmt"
    	"io/fs"
    	"log"
    	"os"
    )
    
    func ExampleWalkDir() {
    	root := "/usr/local/go/bin"
    	fileSystem := os.DirFS(root)
    
    	fs.WalkDir(fileSystem, ".", func(path string, d fs.DirEntry, err error) error {
    		if err != nil {
    			log.Fatal(err)
    		}
    		fmt.Println(path)
    		return nil
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 21 03:21:56 UTC 2021
    - 462 bytes
    - Viewed (0)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top