@@ -73,7 +73,7 @@ const (
73
73
// by purely lexical processing. It applies the following rules
74
74
// iteratively until no further processing can be done:
75
75
//
76
- // 1. Replace multiple Separator elements with a single one.
76
+ // 1. Replace multiple [ Separator] elements with a single one.
77
77
// 2. Eliminate each . path name element (the current directory).
78
78
// 3. Eliminate each inner .. path name element (the parent directory)
79
79
// along with the non-.. element that precedes it.
@@ -231,15 +231,15 @@ func FromSlash(path string) string {
231
231
return strings .ReplaceAll (path , "/" , string (Separator ))
232
232
}
233
233
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] ,
235
235
// usually found in PATH or GOPATH environment variables.
236
236
// Unlike strings.Split, SplitList returns an empty slice when passed an empty
237
237
// string.
238
238
func SplitList (path string ) []string {
239
239
return splitList (path )
240
240
}
241
241
242
- // Split splits path immediately following the final Separator,
242
+ // Split splits path immediately following the final [ Separator] ,
243
243
// separating it into a directory and file name component.
244
244
// If there is no Separator in path, Split returns an empty dir
245
245
// and file set to path.
@@ -254,7 +254,7 @@ func Split(path string) (dir, file string) {
254
254
}
255
255
256
256
// 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
258
258
// are ignored. The result is Cleaned. However, if the argument
259
259
// list is empty or all its elements are empty, Join returns
260
260
// an empty string.
@@ -281,7 +281,7 @@ func Ext(path string) string {
281
281
// links.
282
282
// If path is relative the result will be relative to the current directory,
283
283
// unless one of the components is an absolute symbolic link.
284
- // EvalSymlinks calls Clean on the result.
284
+ // EvalSymlinks calls [ Clean] on the result.
285
285
func EvalSymlinks (path string ) (string , error ) {
286
286
return evalSymlinks (path )
287
287
}
@@ -290,7 +290,7 @@ func EvalSymlinks(path string) (string, error) {
290
290
// If the path is not absolute it will be joined with the current
291
291
// working directory to turn it into an absolute path. The absolute
292
292
// 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.
294
294
func Abs (path string ) (string , error ) {
295
295
return abs (path )
296
296
}
@@ -308,12 +308,12 @@ func unixAbs(path string) (string, error) {
308
308
309
309
// Rel returns a relative path that is lexically equivalent to targpath when
310
310
// 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.
312
312
// On success, the returned path will always be relative to basepath,
313
313
// even if basepath and targpath share no elements.
314
314
// An error is returned if targpath can't be made relative to basepath or if
315
315
// 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.
317
317
func Rel (basepath , targpath string ) (string , error ) {
318
318
baseVol := VolumeName (basepath )
319
319
targVol := VolumeName (targpath )
@@ -396,7 +396,7 @@ var SkipDir error = fs.SkipDir
396
396
// as an error by any function.
397
397
var SkipAll error = fs .SkipAll
398
398
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
400
400
// file or directory.
401
401
//
402
402
// The path argument contains the argument to Walk as a prefix.
@@ -412,9 +412,9 @@ var SkipAll error = fs.SkipAll
412
412
// The info argument is the fs.FileInfo for the named path.
413
413
//
414
414
// 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
416
416
// 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] ,
418
418
// Walk skips all remaining files and directories. Otherwise, if the function
419
419
// returns a non-nil error, Walk stops entirely and returns that error.
420
420
//
@@ -425,14 +425,14 @@ var SkipAll error = fs.SkipAll
425
425
//
426
426
// Walk calls the function with a non-nil err argument in two cases.
427
427
//
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
429
429
// in the tree fails, Walk calls the function with path set to that
430
430
// directory or file's path, info set to nil, and err set to the error
431
431
// from os.Lstat.
432
432
//
433
433
// Second, if a directory's Readdirnames method fails, Walk calls the
434
434
// 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
436
436
// Readdirnames.
437
437
type WalkFunc func (path string , info fs.FileInfo , err error ) error
438
438
@@ -514,7 +514,7 @@ func walk(path string, info fs.FileInfo, walkFn WalkFunc) error {
514
514
// directory in the tree, including root.
515
515
//
516
516
// 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.
518
518
//
519
519
// The files are walked in lexical order, which makes the output deterministic
520
520
// but requires WalkDir to read an entire directory into memory before proceeding
@@ -542,15 +542,15 @@ func WalkDir(root string, fn fs.WalkDirFunc) error {
542
542
// directory in the tree, including root.
543
543
//
544
544
// 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.
546
546
//
547
547
// The files are walked in lexical order, which makes the output deterministic
548
548
// but requires Walk to read an entire directory into memory before proceeding
549
549
// to walk that directory.
550
550
//
551
551
// Walk does not follow symbolic links.
552
552
//
553
- // Walk is less efficient than WalkDir, introduced in Go 1.16,
553
+ // Walk is less efficient than [ WalkDir] , introduced in Go 1.16,
554
554
// which avoids calling os.Lstat on every visited file or directory.
555
555
func Walk (root string , fn WalkFunc ) error {
556
556
info , err := os .Lstat (root )
@@ -611,7 +611,7 @@ func Base(path string) string {
611
611
}
612
612
613
613
// 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
615
615
// slashes are removed.
616
616
// If the path is empty, Dir returns ".".
617
617
// If the path consists entirely of separators, Dir returns a single separator.
0 commit comments