8000 all: rename internal/safefilepath to internal/filepathlite · golang/go@ad22356 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad22356

Browse files
committed
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>
1 parent d69f874 commit ad22356

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

src/go/build/deps_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ var depsRules = `
174174
io/fs
175175
< internal/testlog
176176
< internal/poll
177-
< internal/safefilepath
177+
< internal/filepathlite
178178
< os
179179
< os/signal;
180180
@@ -183,7 +183,7 @@ var depsRules = `
183183
184184
unicode, fmt !< net, os, os/signal;
185185
186-
os/signal, internal/safefilepath, STR
186+
os/signal, internal/filepathlite, STR
187187
< path/filepath
188188
< io/ioutil;
189189

src/internal/safefilepath/path.go renamed to src/internal/filepathlite/path.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// Package safefilepath manipulates operating-system file paths.
6-
package safefilepath
5+
// Package filepathlite manipulates operating-system file paths.
6+
package filepathlite
77

88
import (
99
"errors"

src/internal/safefilepath/path_plan9.go renamed to src/internal/filepathlite/path_plan9.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
package safefilepath
5+
package filepathlite
66

77
import "internal/bytealg"
88

src/internal/safefilepath/path_unix.go renamed to src/internal/filepathlite/path_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
//go:build unix || (js && wasm) || wasip1
66

7-
package safefilepath
7+
package filepathlite
88

99
import "internal/bytealg"
1010

src/internal/safefilepath/path_windows.go renamed to src/internal/filepathlite/path_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
package safefilepath
5+
package filepathlite
66

77
import (
88
"internal/bytealg"

src/os/dir.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package os
66

77
import (
8-
"internal/safefilepath"
8+
"internal/filepathlite"
99
"io"
1010
"io/fs"
1111
"sort"
@@ -146,7 +146,7 @@ func CopyFS(dir string, fsys fs.FS) error {
146146
return err
147147
}
148148

149-
fpath, err := safefilepath.Localize(path)
149+
fpath, err := filepathlite.Localize(path)
150150
if err != nil {
151151
return err
152152
}
@@ -157,7 +157,7 @@ func CopyFS(dir string, fsys fs.FS) error {
157157

158158
// TODO(panjf2000): handle symlinks with the help of fs.ReadLinkFS
159159
// once https://go.dev/issue/49580 is done.
160-
// we also need safefilepath.IsLocal from https://go.dev/cl/564295.
160+
// we also need filepathlite.IsLocal from https://go.dev/cl/564295.
161161
if !d.Type().IsRegular() {
162162
return &PathError{Op: "CopyFS", Path: path, Err: ErrInvalid}
163163
}

src/os/file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ package os
4545

4646
import (
4747
"errors"
48+
"internal/filepathlite"
4849
"internal/poll"
49-
"internal/safefilepath"
5050
"internal/testlog"
5151
"io"
5252
"io/fs"
@@ -766,7 +766,7 @@ func (dir dirFS) join(name string) (string, error) {
766766
if dir == "" {
767767
return "", errors.New("os: DirFS with empty root")
768768
}
769-
name, err := safefilepath.Localize(name)
769+
name, err := filepathlite.Localize(name)
770770
if err != nil {
771771
return "", ErrInvalid
772772
}

src/path/filepath/path.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ package filepath
1313

1414
import (
1515
"errors"
16-
"internal/safefilepath"
16+
"internal/filepathlite"
1717
"io/fs"
1818
"os"
1919
"slices"
@@ -221,7 +221,7 @@ func unixIsLocal(path string) bool {
221221
//
222222
// The path returned by Localize will always be local, as reported by IsLocal.
223223
func Localize(path string) (string, error) {
224-
return safefilepath.Localize(path)
224+
return filepathlite.Localize(path)
225225
}
226226

227227
// ToSlash returns the result of replacing each separator character

src/path/filepath/path_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package filepath
66

77
import (
8-
"internal/safefilepath"
8+
"internal/filepathlite"
99
"os"
1010
"strings"
1111
"syscall"
@@ -42,7 +42,7 @@ func isLocal(path string) bool {
4242
if part == "." || part == ".." {
4343
hasDots = true
4444
}
45-
if safefilepath.IsReservedName(part) {
45+
if filepathlite.IsReservedName(part) {
4646
return false
4747
}
4848
}

0 commit comments

Comments
 (0)
0