aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2024-04-24 10:24:05 -0700
committerDamien Neil <dneil@google.com>2024-04-26 23:07:37 +0000
commitad22356ec660844ec43ccbe9a834845f1a6f7cf8 (patch)
tree3688d6cabcf02613491f0481a61040566cde8e9c
parentd69f87445cb28d68b4d62d8b80dff8a8d5a9203e (diff)
downloadgo-ad22356ec660844ec43ccbe9a834845f1a6f7cf8.tar.gz
go-ad22356ec660844ec43ccbe9a834845f1a6f7cf8.zip
all: rename internal/safefilepath to internal/filepathlite
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>
-rw-r--r--src/go/build/deps_test.go4
-rw-r--r--src/internal/filepathlite/path.go (renamed from src/internal/safefilepath/path.go)4
-rw-r--r--src/internal/filepathlite/path_plan9.go (renamed from src/internal/safefilepath/path_plan9.go)2
-rw-r--r--src/internal/filepathlite/path_unix.go (renamed from src/internal/safefilepath/path_unix.go)2
-rw-r--r--src/internal/filepathlite/path_windows.go (renamed from src/internal/safefilepath/path_windows.go)2
-rw-r--r--src/os/dir.go6
-rw-r--r--src/os/file.go4
-rw-r--r--src/path/filepath/path.go4
-rw-r--r--src/path/filepath/path_windows.go4
9 files changed, 16 insertions, 16 deletions
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
index a3ba8092be..14880d9ef1 100644
--- a/src/go/build/deps_test.go
+++ b/src/go/build/deps_test.go
@@ -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;
diff --git a/src/internal/safefilepath/path.go b/src/internal/filepathlite/path.go
index c2cc6ce5d4..b452987b6b 100644
--- a/src/internal/safefilepath/path.go
+++ b/src/internal/filepathlite/path.go
@@ -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"
diff --git a/src/internal/safefilepath/path_plan9.go b/src/internal/filepathlite/path_plan9.go
index 55627c5102..91a95ddb06 100644
--- a/src/internal/safefilepath/path_plan9.go
+++ b/src/internal/filepathlite/path_plan9.go
@@ -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"
diff --git a/src/internal/safefilepath/path_unix.go b/src/internal/filepathlite/path_unix.go
index 873d0935ec..edad20817f 100644
--- a/src/internal/safefilepath/path_unix.go
+++ b/src/internal/filepathlite/path_unix.go
@@ -4,7 +4,7 @@
//go:build unix || (js && wasm) || wasip1
-package safefilepath
+package filepathlite
import "internal/bytealg"
diff --git a/src/internal/safefilepath/path_windows.go b/src/internal/filepathlite/path_windows.go
index b626196f11..3d7290b14c 100644
--- a/src/internal/safefilepath/path_windows.go
+++ b/src/internal/filepathlite/path_windows.go
@@ -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"
diff --git a/src/os/dir.go b/src/os/dir.go
index dcc18e1814..d75ac17193 100644
--- a/src/os/dir.go
+++ b/src/os/dir.go
@@ -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}
}
diff --git a/src/os/file.go b/src/os/file.go
index ec8ad70660..c3ee31583e 100644
--- a/src/os/file.go
+++ b/src/os/file.go
@@ -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
}
diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go
index 6c8a0aa8b3..cd70c2b318 100644
--- a/src/path/filepath/path.go
+++ b/src/path/filepath/path.go
@@ -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
diff --git a/src/path/filepath/path_windows.go b/src/path/filepath/path_windows.go
index 6adb7d4bc4..44037c45ac 100644
--- a/src/path/filepath/path_windows.go
+++ b/src/path/filepath/path_windows.go
@@ -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
}
}