github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/go/internal/base/path.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package base
     6  
     7  // UncachedCwd returns the current working directory.
     8  // Most callers should use Cwd, which caches the result for future use.
     9  // UncachedCwd is appropriate to call early in program startup before flag parsing,
    10  // because the -C flag may change the current directory.
    11  func UncachedCwd() string
    12  
    13  // Cwd returns the current working directory at the time of the first call.
    14  func Cwd() string
    15  
    16  // ShortPath returns an absolute or relative name for path, whatever is shorter.
    17  func ShortPath(path string) string
    18  
    19  // RelPaths returns a copy of paths with absolute paths
    20  // made relative to the current directory if they would be shorter.
    21  func RelPaths(paths []string) []string
    22  
    23  // IsTestFile reports whether the source file is a set of tests and should therefore
    24  // be excluded from coverage analysis.
    25  func IsTestFile(file string) bool
    26  
    27  // IsNull reports whether the path is a common name for the null device.
    28  // It returns true for /dev/null on Unix, or NUL (case-insensitive) on Windows.
    29  func IsNull(path string) bool