Skip to content

Commit bee4817

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 4894558 commit bee4817

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
@@ -66,8 +66,9 @@ func (rp windowsRelativeParser) ParseFirstComponent(componentWalker ComponentWal
6666
remainder = nil
6767
} else {
6868
name = rp.path[:separator]
69-
rp.path = stripWindowsSeparators(rp.path[separator:])
70-
remainder = windowsRelativeParser{rp.path}
69+
remainder = windowsRelativeParser{
70+
path: stripWindowsSeparators(rp.path[separator:]),
71+
}
7172
}
7273

7374
switch name {

0 commit comments

Comments
 (0)