summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-08-01 00:24:29 -0400
committerUnknwon <joe2010xtmf@163.com>2014-08-01 00:24:29 -0400
commitb95e78f7e6fd1a135d2a03782e193dd9a558fded (patch)
treea354fd4b25ddb20d08eeb9dce56882e2a4cc8c9f /modules
parent568c9b353ec1e18fceef4bd8e9897adf115c295d (diff)
downloadgitea-b95e78f7e6fd1a135d2a03782e193dd9a558fded.tar.gz
gitea-b95e78f7e6fd1a135d2a03782e193dd9a558fded.zip
Mirro fix on PR #311
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/setting.go65
1 files changed, 17 insertions, 48 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 717aeaf6a4..0cf1a78930 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -187,54 +187,23 @@ func NewConfigContext() {
AttachmentMaxFiles = Cfg.MustInt("attachment", "MAX_FILES", 10)
AttachmentEnabled = Cfg.MustBool("attachment", "ENABLE", true)
- TimeFormat = Cfg.MustValue("time", "FORMAT", time.RFC1123)
-
- switch TimeFormat {
- case "ANSIC":
- TimeFormat = time.ANSIC
-
- case "UnixDate":
- TimeFormat = time.UnixDate
-
- case "RubyDate":
- TimeFormat = time.RubyDate
-
- case "RFC822":
- TimeFormat = time.RFC822
-
- case "RFC822Z":
- TimeFormat = time.RFC822Z
-
- case "RFC850":
- TimeFormat = time.RFC850
-
- case "RFC1123":
- TimeFormat = time.RFC1123
-
- case "RFC1123Z":
- TimeFormat = time.RFC1123Z
-
- case "RFC3339":
- TimeFormat = time.RFC3339
-
- case "RFC3339Nano":
- TimeFormat = time.RFC3339Nano
-
- case "Kitchen":
- TimeFormat = time.Kitchen
-
- case "Stamp":
- TimeFormat = time.Stamp
-
- case "StampMilli":
- TimeFormat = time.StampMilli
-
- case "StampMicro":
- TimeFormat = time.StampMicro
-
- case "StampNano":
- TimeFormat = time.StampNano
- }
+ TimeFormat = map[string]string{
+ "ANSIC": time.ANSIC,
+ "UnixDate": time.UnixDate,
+ "RubyDate": time.RubyDate,
+ "RFC822": time.RFC822,
+ "RFC822Z": time.RFC822Z,
+ "RFC850": time.RFC850,
+ "RFC1123": time.RFC1123,
+ "RFC1123Z": time.RFC1123Z,
+ "RFC3339": time.RFC3339,
+ "RFC3339Nano": time.RFC3339Nano,
+ "Kitchen": time.Kitchen,
+ "Stamp": time.Stamp,
+ "StampMilli": time.StampMilli,
+ "StampMicro": time.StampMicro,
+ "StampNano": time.StampNano,
+ }[Cfg.MustValue("time", "FORMAT", "RFC1123")]
if err = os.MkdirAll(AttachmentPath, os.ModePerm); err != nil {
log.Fatal(4, "Could not create directory %s: %s", AttachmentPath, err)