hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 3a6dc6d3f423c4acb79ef21b5a76e616fa2c9477
parent 6cd2110ab295f598907a18da91e34d31407c1d9d
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Sun, 27 Jun 2021 18:06:52 +0200

modules: Use value type for module.Time

Which is in line with how we do it elsewhere.

Diffstat:
Mcommands/config.go | 4++--
Mmodules/module.go | 9+++++----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/commands/config.go b/commands/config.go
@@ -147,7 +147,7 @@ func (m *modMounts) MarshalJSON() ([]byte, error) {
 		return json.Marshal(&struct {
 			Path        string                 `json:"path"`
 			Version     string                 `json:"version"`
-			Time        *time.Time             `json:"time"`
+			Time        time.Time              `json:"time"`
 			Owner       string                 `json:"owner"`
 			Dir         string                 `json:"dir"`
 			Meta        map[string]interface{} `json:"meta"`
@@ -169,7 +169,7 @@ func (m *modMounts) MarshalJSON() ([]byte, error) {
 	return json.Marshal(&struct {
 		Path    string     `json:"path"`
 		Version string     `json:"version"`
-		Time    *time.Time `json:"time"`
+		Time    time.Time  `json:"time"`
 		Owner   string     `json:"owner"`
 		Dir     string     `json:"dir"`
 		Mounts  []modMount `json:"mounts"`
diff --git a/modules/module.go b/modules/module.go
@@ -68,7 +68,7 @@ type Module interface {
 	Version() string
 
 	// Time version was created.
-	Time() *time.Time
+	Time() time.Time
 
 	// Whether this module's dir is a watch candidate.
 	Watch() bool
@@ -159,12 +159,13 @@ func (m *moduleAdapter) Version() string {
 	return m.gomod.Version
 }
 
-func (m *moduleAdapter) Time() *time.Time {
+func (m *moduleAdapter) Time() time.Time {
 	if !m.IsGoMod() || m.gomod.Time == nil {
-		return nil
+		return time.Time{}
 	}
 
-	return m.gomod.Time
+	return *m.gomod.Time
+
 }
 
 func (m *moduleAdapter) Watch() bool {