]> Cypherpunks repositories - gostls13.git/commit
cmd/go: clean paths before using them form index functions
authorMichael Matloob <matloob@golang.org>
Wed, 8 Jun 2022 18:26:44 +0000 (14:26 -0400)
committerMichael Matloob <matloob@golang.org>
Wed, 8 Jun 2022 21:00:49 +0000 (21:00 +0000)
commit1292176bc98be4b7b9d24abec05e88b3dbd89e21
treec53dc33f08e08984d9984c1c4f2f4c9780c56410
parent1858ea5d857f3a874bef131b7e1bc162d05b3366
cmd/go: clean paths before using them form index functions

We use str.TrimFilePathPrefix to trim the module root prefix and get the
relative path of each package in the module when scanning the module
and in the RelPath function.  Make sure to clean the path before
indexing and in RelPath to ensure that each path starts with that
prefix, because walk will clean the root path before joining each
subdirectory path to it.

Change-Id: I1dc1eddbd42030eb6d5d8e76a8675f94216447c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/411118
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/modindex/read.go
src/cmd/go/testdata/script/list_replace_absolute_windows.txt [new file with mode: 0644]