module: remove trailing '@' for versionless Versions
Change-Id: I836874b96805779bfb1ddf3cd20abe806378fbb3
Reviewed-on: https://go-review.googlesource.com/c/mod/+/205857
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
diff --git a/module/module.go b/module/module.go
index 21f1239..6cd3728 100644
--- a/module/module.go
+++ b/module/module.go
@@ -123,8 +123,12 @@
Version string `json:",omitempty"`
}
-// String returns the module version syntax Path@Version.
+// String returns a representation of the Version suitable for logging
+// (Path@Version, or just Path if Version is empty).
func (m Version) String() string {
+ if m.Version == "" {
+ return m.Path
+ }
return m.Path + "@" + m.Version
}