Correctly normalize Windows package paths.
When the name passed to util.NormalizeName contains backslashes from a
Windows filepath, the backslashes must be first converted to forward
slashes (used by all package names, including on Windows). This fixes
the strings.TrimPrefix call used to strip the repo root from the
subpackage.
As a result of this, subpackages in lockfiles are written identically
on Windows as other Unix platforms and no duplicate subpackages are
introduced.
Fixes #389.
diff --git a/util/util.go b/util/util.go
index e32fffa..5f779ed 100644
--- a/util/util.go
+++ b/util/util.go
@@ -311,6 +311,7 @@
}
}
+ name = filepath.ToSlash(name)
root := GetRootFromPackage(name)
extra := strings.TrimPrefix(name, root)
if len(extra) > 0 && extra != "/" {