Skip to content

Commit 68f1281

Browse files
committed
ParseFirstComponent(): Remove unnecesary mutation of rp
This method doesn't take a pointer receiver, so mutating rp.path is pointless.
1 parent 59ef57e commit 68f1281

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pkg/filesystem/path/unix_parser.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ func (rp unixRelativeParser) ParseFirstComponent(componentWalker ComponentWalker
6464
remainder = nil
6565
} else {
6666
name = rp.path[:slash]
67-
rp.path = stripUNIXSeparators(rp.path[slash:])
68-
remainder = unixRelativeParser{rp.path}
67+
remainder = unixRelativeParser{
68+
path: stripUNIXSeparators(rp.path[slash:]),
69+
}
6970
}
7071

7172
switch name {

pkg/filesystem/path/windows_parser.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ func (rp windowsRelativeParser) ParseFirstComponent(componentWalker ComponentWal
6868
remainder = nil
6969
} else {
7070
name = rp.path[:separator]
71-
rp.path = stripWindowsSeparators(rp.path[separator:])
72-
remainder = windowsRelativeParser{rp.path}
71+
remainder = windowsRelativeParser{
72+
path: stripWindowsSeparators(rp.path[separator:]),
73+
}
7374
}
7475

7576
switch name {

0 commit comments

Comments
 (0)