diff options
author | kolaente <konrad@kola-entertainments.de> | 2019-06-12 21:41:28 +0200 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-06-12 15:41:28 -0400 |
commit | f9ec2f89f2265bc1371a6c62359de9816534fa6b (patch) | |
tree | f48b138a457e5ac6cf843bbb38400926704370f7 /modules/setting | |
parent | 5832f8d90df2d72cb38698c3e9050f2b29717dc7 (diff) | |
download | gitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.tar.gz gitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.zip |
Add golangci (#6418)
Diffstat (limited to 'modules/setting')
-rw-r--r-- | modules/setting/log.go | 12 | ||||
-rw-r--r-- | modules/setting/setting.go | 7 |
2 files changed, 12 insertions, 7 deletions
diff --git a/modules/setting/log.go b/modules/setting/log.go index 9f4bbf9d87..5e2d2d769d 100644 --- a/modules/setting/log.go +++ b/modules/setting/log.go @@ -150,8 +150,6 @@ func generateNamedLogger(key string, options defaultLogOptions) *LogDescription sections := strings.Split(Cfg.Section("log").Key(strings.ToUpper(key)).MustString(""), ",") - //description.Configs = make([]string, len(description.Sections)) - for i := 0; i < len(sections); i++ { sections[i] = strings.TrimSpace(sections[i]) } @@ -167,7 +165,10 @@ func generateNamedLogger(key string, options defaultLogOptions) *LogDescription provider, config, levelName := generateLogConfig(sec, name, options) - log.NewNamedLogger(key, options.bufferLength, name, provider, config) + if err := log.NewNamedLogger(key, options.bufferLength, name, provider, config); err != nil { + // Maybe panic here? + log.Error("Could not create new named logger: %v", err.Error()) + } description.SubLogDescriptions = append(description.SubLogDescriptions, SubLogDescription{ Name: name, @@ -242,7 +243,10 @@ func newLogService() { } if !useConsole { - log.DelLogger("console") + err := log.DelLogger("console") + if err != nil { + log.Fatal("DelLogger: %v", err) + } } for _, name := range sections { diff --git a/modules/setting/setting.go b/modules/setting/setting.go index ff53e9a375..b550836bc1 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -545,13 +545,14 @@ func NewContext() { AppName = Cfg.Section("").Key("APP_NAME").MustString("Gitea: Git with a cup of tea") Protocol = HTTP - if sec.Key("PROTOCOL").String() == "https" { + switch sec.Key("PROTOCOL").String() { + case "https": Protocol = HTTPS CertFile = sec.Key("CERT_FILE").String() KeyFile = sec.Key("KEY_FILE").String() - } else if sec.Key("PROTOCOL").String() == "fcgi" { + case "fcgi": Protocol = FCGI - } else if sec.Key("PROTOCOL").String() == "unix" { + case "unix": Protocol = UnixSocket UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666") UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32) |