From 8bc0ef8fdc6f29ee8a3890404fe9c48d6746c7f2 Mon Sep 17 00:00:00 2001 From: Steve Burns Date: Tue, 14 Jan 2020 20:42:00 -0700 Subject: [PATCH 1/4] Attempt to change the output of module manifest --- internal/modsdir/manifest.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/modsdir/manifest.go b/internal/modsdir/manifest.go index 36f6c033f..8372f4384 100644 --- a/internal/modsdir/manifest.go +++ b/internal/modsdir/manifest.go @@ -115,6 +115,12 @@ func (m Manifest) WriteSnapshot(w io.Writer) error { } else { record.VersionStr = "" } + + // Ensure Dir is written in a format that can be read by Linux and + // Windows nodes + if record.Dir != "" { + record.Dir = filepath.ToSlash(record.Dir) + } write.Records = append(write.Records, record) } From 98e612ee50296ac5f5852b26b6b31ecabdc5f628 Mon Sep 17 00:00:00 2001 From: Steven Burns Date: Tue, 14 Jan 2020 21:06:42 -0700 Subject: [PATCH 2/4] Add condition for conversion of module path in manifest --- internal/modsdir/manifest.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/modsdir/manifest.go b/internal/modsdir/manifest.go index 8372f4384..651064eff 100644 --- a/internal/modsdir/manifest.go +++ b/internal/modsdir/manifest.go @@ -81,6 +81,13 @@ func ReadManifestSnapshot(r io.Reader) (Manifest, error) { return nil, fmt.Errorf("invalid version %q for %s: %s", record.VersionStr, record.Key, err) } } + + // Ensure Windows is using the proper modules directory format after + // reading the modules manifest + if string(filepath.Separator) != "/" { + record.Dir = filepath.FromSlash(record.Dir) + } + if _, exists := new[record.Key]; exists { // This should never happen in any valid file, so we'll catch it // and report it to avoid confusing/undefined behavior if the From 43b855743b8cc670db779630368f874d33dde0eb Mon Sep 17 00:00:00 2001 From: Steve Burns Date: Tue, 14 Jan 2020 21:13:36 -0700 Subject: [PATCH 3/4] Uniformity for module manifest dir read/write --- internal/modsdir/manifest.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/modsdir/manifest.go b/internal/modsdir/manifest.go index 651064eff..148aaf72b 100644 --- a/internal/modsdir/manifest.go +++ b/internal/modsdir/manifest.go @@ -125,7 +125,7 @@ func (m Manifest) WriteSnapshot(w io.Writer) error { // Ensure Dir is written in a format that can be read by Linux and // Windows nodes - if record.Dir != "" { + if string(filepath.Separator) != "/" { record.Dir = filepath.ToSlash(record.Dir) } write.Records = append(write.Records, record) From 26305a83a36de71d3d6160c99873ac065bc511af Mon Sep 17 00:00:00 2001 From: Steve Burns Date: Fri, 17 Jan 2020 12:14:17 -0700 Subject: [PATCH 4/4] Remove unecessary conditions for module manifest read and write functions --- internal/modsdir/manifest.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/internal/modsdir/manifest.go b/internal/modsdir/manifest.go index 148aaf72b..92b40899a 100644 --- a/internal/modsdir/manifest.go +++ b/internal/modsdir/manifest.go @@ -82,11 +82,9 @@ func ReadManifestSnapshot(r io.Reader) (Manifest, error) { } } - // Ensure Windows is using the proper modules directory format after - // reading the modules manifest - if string(filepath.Separator) != "/" { - record.Dir = filepath.FromSlash(record.Dir) - } + // Ensure Windows is using the proper modules path format after + // reading the modules manifest Dir records + record.Dir = filepath.FromSlash(record.Dir) if _, exists := new[record.Key]; exists { // This should never happen in any valid file, so we'll catch it @@ -124,10 +122,8 @@ func (m Manifest) WriteSnapshot(w io.Writer) error { } // Ensure Dir is written in a format that can be read by Linux and - // Windows nodes - if string(filepath.Separator) != "/" { - record.Dir = filepath.ToSlash(record.Dir) - } + // Windows nodes for remote and apply compatibility + record.Dir = filepath.ToSlash(record.Dir) write.Records = append(write.Records, record) }