@@ -73,7 +73,7 @@ const (
7373// by purely lexical processing. It applies the following rules
7474// iteratively until no further processing can be done:
7575//
76- // 1. Replace multiple Separator elements with a single one.
76+ // 1. Replace multiple [ Separator] elements with a single one.
7777// 2. Eliminate each . path name element (the current directory).
7878// 3. Eliminate each inner .. path name element (the parent directory)
7979// along with the non-.. element that precedes it.
@@ -231,15 +231,15 @@ func FromSlash(path string) string {
231231 return strings .ReplaceAll (path , "/" , string (Separator ))
232232}
233233
234- // SplitList splits a list of paths joined by the OS-specific ListSeparator,
234+ // SplitList splits a list of paths joined by the OS-specific [ ListSeparator] ,
235235// usually found in PATH or GOPATH environment variables.
236236// Unlike strings.Split, SplitList returns an empty slice when passed an empty
237237// string.
238238func SplitList (path string ) []string {
239239 return splitList (path )
240240}
241241
242- // Split splits path immediately following the final Separator,
242+ // Split splits path immediately following the final [ Separator] ,
243243// separating it into a directory and file name component.
244244// If there is no Separator in path, Split returns an empty dir
245245// and file set to path.
@@ -254,7 +254,7 @@ func Split(path string) (dir, file string) {
254254}
255255
256256// Join joins any number of path elements into a single path,
257- // separating them with an OS specific Separator. Empty elements
257+ // separating them with an OS specific [ Separator] . Empty elements
258258// are ignored. The result is Cleaned. However, if the argument
259259// list is empty or all its elements are empty, Join returns
260260// an empty string.
@@ -281,7 +281,7 @@ func Ext(path string) string {
281281// links.
282282// If path is relative the result will be relative to the current directory,
283283// unless one of the components is an absolute symbolic link.
284- // EvalSymlinks calls Clean on the result.
284+ // EvalSymlinks calls [ Clean] on the result.
285285func EvalSymlinks (path string ) (string , error ) {
286286 return evalSymlinks (path )
287287}
@@ -290,7 +290,7 @@ func EvalSymlinks(path string) (string, error) {
290290// If the path is not absolute it will be joined with the current
291291// working directory to turn it into an absolute path. The absolute
292292// path name for a given file is not guaranteed to be unique.
293- // Abs calls Clean on the result.
293+ // Abs calls [ Clean] on the result.
294294func Abs (path string ) (string , error ) {
295295 return abs (path )
296296}
@@ -308,12 +308,12 @@ func unixAbs(path string) (string, error) {
308308
309309// Rel returns a relative path that is lexically equivalent to targpath when
310310// joined to basepath with an intervening separator. That is,
311- // Join(basepath, Rel(basepath, targpath)) is equivalent to targpath itself.
311+ // [ Join] (basepath, Rel(basepath, targpath)) is equivalent to targpath itself.
312312// On success, the returned path will always be relative to basepath,
313313// even if basepath and targpath share no elements.
314314// An error is returned if targpath can't be made relative to basepath or if
315315// knowing the current working directory would be necessary to compute it.
316- // Rel calls Clean on the result.
316+ // Rel calls [ Clean] on the result.
317317func Rel (basepath , targpath string ) (string , error ) {
318318 baseVol := VolumeName (basepath )
319319 targVol := VolumeName (targpath )
@@ -396,7 +396,7 @@ var SkipDir error = fs.SkipDir
396396// as an error by any function.
397397var SkipAll error = fs .SkipAll
398398
399- // WalkFunc is the type of the function called by Walk to visit each
399+ // WalkFunc is the type of the function called by [ Walk] to visit each
400400// file or directory.
401401//
402402// The path argument contains the argument to Walk as a prefix.
@@ -412,9 +412,9 @@ var SkipAll error = fs.SkipAll
412412// The info argument is the fs.FileInfo for the named path.
413413//
414414// The error result returned by the function controls how Walk continues.
415- // If the function returns the special value SkipDir, Walk skips the
415+ // If the function returns the special value [ SkipDir] , Walk skips the
416416// current directory (path if info.IsDir() is true, otherwise path's
417- // parent directory). If the function returns the special value SkipAll,
417+ // parent directory). If the function returns the special value [ SkipAll] ,
418418// Walk skips all remaining files and directories. Otherwise, if the function
419419// returns a non-nil error, Walk stops entirely and returns that error.
420420//
@@ -425,14 +425,14 @@ var SkipAll error = fs.SkipAll
425425//
426426// Walk calls the function with a non-nil err argument in two cases.
427427//
428- // First, if an os.Lstat on the root directory or any directory or file
428+ // First, if an [ os.Lstat] on the root directory or any directory or file
429429// in the tree fails, Walk calls the function with path set to that
430430// directory or file's path, info set to nil, and err set to the error
431431// from os.Lstat.
432432//
433433// Second, if a directory's Readdirnames method fails, Walk calls the
434434// function with path set to the directory's path, info, set to an
435- // fs.FileInfo describing the directory, and err set to the error from
435+ // [ fs.FileInfo] describing the directory, and err set to the error from
436436// Readdirnames.
437437type WalkFunc func (path string , info fs.FileInfo , err error ) error
438438
@@ -514,7 +514,7 @@ func walk(path string, info fs.FileInfo, walkFn WalkFunc) error {
514514// directory in the tree, including root.
515515//
516516// All errors that arise visiting files and directories are filtered by fn:
517- // see the fs.WalkDirFunc documentation for details.
517+ // see the [ fs.WalkDirFunc] documentation for details.
518518//
519519// The files are walked in lexical order, which makes the output deterministic
520520// but requires WalkDir to read an entire directory into memory before proceeding
@@ -542,15 +542,15 @@ func WalkDir(root string, fn fs.WalkDirFunc) error {
542542// directory in the tree, including root.
543543//
544544// All errors that arise visiting files and directories are filtered by fn:
545- // see the WalkFunc documentation for details.
545+ // see the [ WalkFunc] documentation for details.
546546//
547547// The files are walked in lexical order, which makes the output deterministic
548548// but requires Walk to read an entire directory into memory before proceeding
549549// to walk that directory.
550550//
551551// Walk does not follow symbolic links.
552552//
553- // Walk is less efficient than WalkDir, introduced in Go 1.16,
553+ // Walk is less efficient than [ WalkDir] , introduced in Go 1.16,
554554// which avoids calling os.Lstat on every visited file or directory.
555555func Walk (root string , fn WalkFunc ) error {
556556 info , err := os .Lstat (root )
@@ -611,7 +611,7 @@ func Base(path string) string {
611611}
612612
613613// Dir returns all but the last element of path, typically the path's directory.
614- // After dropping the final element, Dir calls Clean on the path and trailing
614+ // After dropping the final element, Dir calls [ Clean] on the path and trailing
615615// slashes are removed.
616616// If the path is empty, Dir returns ".".
617617// If the path consists entirely of separators, Dir returns a single separator.
0 commit comments