]> Cypherpunks repositories - gostls13.git/commitdiff
all: rename internal/safefilepath to internal/filepathlite
authorDamien Neil <dneil@google.com>
Wed, 24 Apr 2024 17:24:05 +0000 (10:24 -0700)
committerDamien Neil <dneil@google.com>
Fri, 26 Apr 2024 23:07:37 +0000 (23:07 +0000)
The safefilepath package was originally added to contain
the FromFS function. We subsequently added FromFS to path/filepath
as Localize. The safefilepath package now exists only to permit
the os package to import Localize.

Rename safefilepath to filepathlite to better indicate that it's
a low-dependency version of filepath.

Change-Id: I4c5f9b28e8581f841947b48c5cac9954cd0c9535
Reviewed-on: https://go-review.googlesource.com/c/go/+/581517
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/go/build/deps_test.go
src/internal/filepathlite/path.go [moved from src/internal/safefilepath/path.go with 86% similarity]
src/internal/filepathlite/path_plan9.go [moved from src/internal/safefilepath/path_plan9.go with 94% similarity]
src/internal/filepathlite/path_unix.go [moved from src/internal/safefilepath/path_unix.go with 94% similarity]
src/internal/filepathlite/path_windows.go [moved from src/internal/safefilepath/path_windows.go with 99% similarity]
src/os/dir.go
src/os/file.go
src/path/filepath/path.go
src/path/filepath/path_windows.go

index a3ba8092be65732cc101a768511c6cbd2cbb841d..14880d9ef120216fcc302cdab923e6bc9ab89257 100644 (file)
@@ -174,7 +174,7 @@ var depsRules = `
        io/fs
        < internal/testlog
        < internal/poll
-       < internal/safefilepath
+       < internal/filepathlite
        < os
        < os/signal;
 
@@ -183,7 +183,7 @@ var depsRules = `
 
        unicode, fmt !< net, os, os/signal;
 
-       os/signal, internal/safefilepath, STR
+       os/signal, internal/filepathlite, STR
        < path/filepath
        < io/ioutil;
 
similarity index 86%
rename from src/internal/safefilepath/path.go
rename to src/internal/filepathlite/path.go
index c2cc6ce5d4965a10d0af5087addf7f90152d472b..b452987b6be8f2a34856d97e274ff2c69c03535d 100644 (file)
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Package safefilepath manipulates operating-system file paths.
-package safefilepath
+// Package filepathlite manipulates operating-system file paths.
+package filepathlite
 
 import (
        "errors"
similarity index 94%
rename from src/internal/safefilepath/path_plan9.go
rename to src/internal/filepathlite/path_plan9.go
index 55627c5102a9c998274b57a15b56724c3b525ae2..91a95ddb06d61b60c061eefe8d817f6167845803 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package safefilepath
+package filepathlite
 
 import "internal/bytealg"
 
similarity index 94%
rename from src/internal/safefilepath/path_unix.go
rename to src/internal/filepathlite/path_unix.go
index 873d0935ec87141a59cf53410a19a83d86ac800d..edad20817fba40fc9cdd291f6eb9f341e0b19c8d 100644 (file)
@@ -4,7 +4,7 @@
 
 //go:build unix || (js && wasm) || wasip1
 
-package safefilepath
+package filepathlite
 
 import "internal/bytealg"
 
similarity index 99%
rename from src/internal/safefilepath/path_windows.go
rename to src/internal/filepathlite/path_windows.go
index b626196f11c56c2b9b1a4665a93ef64a5f8d753d..3d7290b14c3bbf805d483094a4d255301ce6ac2f 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package safefilepath
+package filepathlite
 
 import (
        "internal/bytealg"
index dcc18e18144783d712028e7776832e851f8d5179..d75ac171933961b37c159627b0c80279aa542e38 100644 (file)
@@ -5,7 +5,7 @@
 package os
 
 import (
-       "internal/safefilepath"
+       "internal/filepathlite"
        "io"
        "io/fs"
        "sort"
@@ -146,7 +146,7 @@ func CopyFS(dir string, fsys fs.FS) error {
                        return err
                }
 
-               fpath, err := safefilepath.Localize(path)
+               fpath, err := filepathlite.Localize(path)
                if err != nil {
                        return err
                }
@@ -157,7 +157,7 @@ func CopyFS(dir string, fsys fs.FS) error {
 
                // TODO(panjf2000): handle symlinks with the help of fs.ReadLinkFS
                //              once https://go.dev/issue/49580 is done.
-               //              we also need safefilepath.IsLocal from https://go.dev/cl/564295.
+               //              we also need filepathlite.IsLocal from https://go.dev/cl/564295.
                if !d.Type().IsRegular() {
                        return &PathError{Op: "CopyFS", Path: path, Err: ErrInvalid}
                }
index ec8ad706607865da9f084fc41bbd77eebe3e8709..c3ee31583e32f6349e7d79c8064011e37605191a 100644 (file)
@@ -45,8 +45,8 @@ package os
 
 import (
        "errors"
+       "internal/filepathlite"
        "internal/poll"
-       "internal/safefilepath"
        "internal/testlog"
        "io"
        "io/fs"
@@ -766,7 +766,7 @@ func (dir dirFS) join(name string) (string, error) {
        if dir == "" {
                return "", errors.New("os: DirFS with empty root")
        }
-       name, err := safefilepath.Localize(name)
+       name, err := filepathlite.Localize(name)
        if err != nil {
                return "", ErrInvalid
        }
index 6c8a0aa8b35b8e74f135bd065161a27b6c26c3d5..cd70c2b3187fc50f1253a8659189e211eedf4a9d 100644 (file)
@@ -13,7 +13,7 @@ package filepath
 
 import (
        "errors"
-       "internal/safefilepath"
+       "internal/filepathlite"
        "io/fs"
        "os"
        "slices"
@@ -221,7 +221,7 @@ func unixIsLocal(path string) bool {
 //
 // The path returned by Localize will always be local, as reported by IsLocal.
 func Localize(path string) (string, error) {
-       return safefilepath.Localize(path)
+       return filepathlite.Localize(path)
 }
 
 // ToSlash returns the result of replacing each separator character
index 6adb7d4bc4b2f007dacbb3782b7717eff825eb2e..44037c45ace4f0fcdb56f73b5e78be372444b684 100644 (file)
@@ -5,7 +5,7 @@
 package filepath
 
 import (
-       "internal/safefilepath"
+       "internal/filepathlite"
        "os"
        "strings"
        "syscall"
@@ -42,7 +42,7 @@ func isLocal(path string) bool {
                if part == "." || part == ".." {
                        hasDots = true
                }
-               if safefilepath.IsReservedName(part) {
+               if filepathlite.IsReservedName(part) {
                        return false
                }
        }