Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for removeLastDir (0.12 sec)

  1. cmd/import-boss/main.go

    	_, err := os.Stat(filepath.Join(filepath.Dir(path), goModFile))
    	return err == nil
    }
    
    // removeLastDir removes the last directory, but leaves the file name
    // unchanged. It returns the new path and the removed directory. So:
    // "a/b/c/file" -> ("a/b/file", "c")
    func removeLastDir(path string) (newPath, removedDir string) {
    	dir, file := filepath.Split(path)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 16 12:36:49 UTC 2024
    - 14.7K bytes
    - Viewed (0)
  2. cmd/import-boss/main_test.go

    	table := map[string]struct{ newPath, removedDir string }{
    		"a/b/c": {"a/c", "b"},
    	}
    	for slashInput, expect := range table {
    		input := filepath.FromSlash(slashInput)
    
    		gotPath, gotRemoved := removeLastDir(input)
    		if e, a := filepath.FromSlash(expect.newPath), gotPath; e != a {
    			t.Errorf("%v: wanted %v, got %v", input, e, a)
    		}
    		if e, a := filepath.FromSlash(expect.removedDir), gotRemoved; e != a {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 16 12:36:49 UTC 2024
    - 8.8K bytes
    - Viewed (0)
Back to top