Skip to content

Commit 424c223

Browse files
committed
pkg/longpath: deprecate Prefix const
This const was exported because it was in use by pkg/symlink. This dependency was removed in a48c6e3, after which this const was only used internally. This patch deprecates the const and introduces a non-exported const to use. There are no known external consumers of this const, so we may skip deprecating it. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 680e6d6 commit 424c223

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

pkg/longpath/longpath.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@ import (
1212
)
1313

1414
// Prefix is the longpath prefix for Windows file paths.
15-
const Prefix = `\\?\`
15+
//
16+
// Deprecated: this const is only used internally, and will be removed in the next release
17+
const Prefix = longPathPrefix
18+
19+
// longPathPrefix is the longpath prefix for Windows file paths.
20+
const longPathPrefix = `\\?\`
1621

1722
// AddPrefix adds the Windows long path prefix to the path provided if
1823
// it does not already have it.
1924
func AddPrefix(path string) string {
20-
if !strings.HasPrefix(path, Prefix) {
25+
if !strings.HasPrefix(path, longPathPrefix) {
2126
if strings.HasPrefix(path, `\\`) {
2227
// This is a UNC path, so we need to add 'UNC' to the path as well.
23-
path = Prefix + `UNC` + path[1:]
28+
path = longPathPrefix + `UNC` + path[1:]
2429
} else {
25-
path = Prefix + path
30+
path = longPathPrefix + path
2631
}
2732
}
2833
return path

0 commit comments

Comments
 (0)