Enable stricter linting with golangci-lint (#316)

* update golangci-lint

* add golangci config file w/ more linters

* correct issues flagged by stricter linters

* add more generous timeout for golangci-lint

* add some style + formatting guidelines

* move timeout to config file

* go fmt
This commit is contained in:
tobi 2021-11-22 08:46:19 +01:00 committed by GitHub
commit f8630348b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 227 additions and 163 deletions

View file

@ -51,6 +51,7 @@ func oddOrEven(n int) string {
}
func noescape(str string) template.HTML {
/* #nosec G203 */
return template.HTML(str)
}
@ -67,19 +68,21 @@ type iconWithLabel struct {
func visibilityIcon(visibility model.Visibility) template.HTML {
var icon iconWithLabel
if visibility == model.VisibilityPublic {
switch visibility {
case model.VisibilityPublic:
icon = iconWithLabel{"globe", "public"}
} else if visibility == model.VisibilityUnlisted {
case model.VisibilityUnlisted:
icon = iconWithLabel{"unlock", "unlisted"}
} else if visibility == model.VisibilityPrivate {
case model.VisibilityPrivate:
icon = iconWithLabel{"lock", "private"}
} else if visibility == model.VisibilityMutualsOnly {
case model.VisibilityMutualsOnly:
icon = iconWithLabel{"handshake-o", "mutuals only"}
} else if visibility == model.VisibilityDirect {
case model.VisibilityDirect:
icon = iconWithLabel{"envelope", "direct"}
}
return template.HTML(fmt.Sprintf(`<i aria-label="Visiblity: %v" class="fa fa-%v"></i>`, icon.label, icon.faIcon))
/* #nosec G203 */
return template.HTML(fmt.Sprintf(`<i aria-label="Visibility: %v" class="fa fa-%v"></i>`, icon.label, icon.faIcon))
}
func loadTemplateFunctions(engine *gin.Engine) {