clean(all): gocritic warnings cleanup

This commit is contained in:
Tit Petric
2019-02-05 16:14:28 +01:00
parent 86c19a743d
commit 087196f571
9 changed files with 12 additions and 9 deletions
+1
View File
@@ -44,5 +44,6 @@ func cliRouter(commands ...string) {
switch commands[0] {
case "users":
cliExecUsers(commands[1:]...)
default:
}
}
+1
View File
@@ -159,6 +159,7 @@ func (b recordReportBuilder) Cast(row sqlx.ColScanner) map[string]interface{} {
switch cv := v.(type) {
case []uint8:
out[k] = string(cv)
default:
}
}
+2 -2
View File
@@ -24,8 +24,8 @@ import (
)
var (
jwtVerifier (func(http.Handler) http.Handler)
jwtAuthenticator (func(http.Handler) http.Handler)
jwtVerifier func(http.Handler) http.Handler
jwtAuthenticator func(http.Handler) http.Handler
jwtEncoder auth.TokenEncoder
)
+1 -1
View File
@@ -57,7 +57,7 @@ func (*Social) Init(prefix ...string) *Social {
}
social = new(Social)
flag.BoolVar(&social.Enabled, "auth-social-enabled", true, "SocialAuth enabled")
flag.BoolVar(&social.Enabled, "auth-social-enabled", false, "SocialAuth enabled")
b("Facebook", &social.FacebookKey, &social.FacebookSecret)
b("GPlus", &social.GPlusKey, &social.GPlusSecret)
+1 -1
View File
@@ -26,7 +26,7 @@ type Downloadable interface {
func NewAttachmentDownloadable(ah AttachmentAPI) *Attachment {
serve := func(f interface{}, err error, w http.ResponseWriter, r *http.Request) {
if err != nil {
switch true {
switch {
// @todo: compare concrete exported error type? Go2 .As() like check?
case err.Error() == "crust.messaging.repository.AttachmentNotFound":
w.WriteHeader(http.StatusNotFound)
+1 -1
View File
@@ -47,7 +47,7 @@ func (svc *event) Message(m *types.Message) error {
func (svc *event) MessageFlag(f *types.MessageFlag) error {
var p outgoing.MessageEncoder
switch true {
switch {
case f.IsBookmark():
// Leaving this here so it is obvious.
return nil
+2 -2
View File
@@ -24,8 +24,8 @@ import (
)
var (
jwtVerifier (func(http.Handler) http.Handler)
jwtAuthenticator (func(http.Handler) http.Handler)
jwtVerifier func(http.Handler) http.Handler
jwtAuthenticator func(http.Handler) http.Handler
jwtEncoder auth.TokenEncoder
)
+1
View File
@@ -186,6 +186,7 @@ func (r *user) prepare(user *types.User, fields ...string) (err error) {
}
user.Teams = teams
}
default:
}
}
return
+2 -2
View File
@@ -23,8 +23,8 @@ import (
)
var (
jwtVerifier (func(http.Handler) http.Handler)
jwtAuthenticator (func(http.Handler) http.Handler)
jwtVerifier func(http.Handler) http.Handler
jwtAuthenticator func(http.Handler) http.Handler
jwtEncoder auth.TokenEncoder
)