aboutsummaryrefslogtreecommitdiffstats
path: root/repository
diff options
context:
space:
mode:
Diffstat (limited to 'repository')
-rw-r--r--repository/config.go9
-rw-r--r--repository/config_git.go4
-rw-r--r--repository/config_mem.go10
3 files changed, 11 insertions, 12 deletions
diff --git a/repository/config.go b/repository/config.go
index ec5094e0..d72e7b4e 100644
--- a/repository/config.go
+++ b/repository/config.go
@@ -32,18 +32,17 @@ type Config interface {
// ReadTimestamp read a single timestamp value from the config
// Return ErrNoConfigEntry or ErrMultipleConfigEntry if
// there is zero or more than one entry for this key
- ReadTimestamp(key string) (*time.Time, error)
+ ReadTimestamp(key string) (time.Time, error)
// RemoveAll removes all key/value pair matching the key prefix
RemoveAll(keyPrefix string) error
}
-func parseTimestamp(s string) (*time.Time, error) {
+func parseTimestamp(s string) (time.Time, error) {
timestamp, err := strconv.Atoi(s)
if err != nil {
- return nil, err
+ return time.Time{}, err
}
- t := time.Unix(int64(timestamp), 0)
- return &t, nil
+ return time.Unix(int64(timestamp), 0), nil
}
diff --git a/repository/config_git.go b/repository/config_git.go
index eac882a2..63ca2457 100644
--- a/repository/config_git.go
+++ b/repository/config_git.go
@@ -111,10 +111,10 @@ func (gc *gitConfig) ReadBool(key string) (bool, error) {
return strconv.ParseBool(val)
}
-func (gc *gitConfig) ReadTimestamp(key string) (*time.Time, error) {
+func (gc *gitConfig) ReadTimestamp(key string) (time.Time, error) {
value, err := gc.ReadString(key)
if err != nil {
- return nil, err
+ return time.Time{}, err
}
return parseTimestamp(value)
}
diff --git a/repository/config_mem.go b/repository/config_mem.go
index e2cffd9c..bd680d03 100644
--- a/repository/config_mem.go
+++ b/repository/config_mem.go
@@ -59,18 +59,18 @@ func (mc *memConfig) ReadBool(key string) (bool, error) {
return strconv.ParseBool(val)
}
-func (mc *memConfig) ReadTimestamp(key string) (*time.Time, error) {
+func (mc *memConfig) ReadTimestamp(key string) (time.Time, error) {
value, err := mc.ReadString(key)
if err != nil {
- return nil, err
+ return time.Time{}, err
}
+
timestamp, err := strconv.Atoi(value)
if err != nil {
- return nil, err
+ return time.Time{}, err
}
- t := time.Unix(int64(timestamp), 0)
- return &t, nil
+ return time.Unix(int64(timestamp), 0), nil
}
// RmConfigs remove all key/value pair matching the key prefix