mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-05 02:29:54 +00:00
Please staticcheck
I ignored ST1005: error strings should not be capitalized and some others
This commit is contained in:
parent
cc01a3551d
commit
75ded17a03
@ -193,7 +193,7 @@ func ReadConfigFile(path string) error {
|
|||||||
TelegramEnabled = (TelegramBotToken != "") && (TelegramBotName != "")
|
TelegramEnabled = (TelegramBotToken != "") && (TelegramBotName != "")
|
||||||
|
|
||||||
// This URL makes much more sense. If no URL is set or the protocol is forgotten, assume HTTP.
|
// This URL makes much more sense. If no URL is set or the protocol is forgotten, assume HTTP.
|
||||||
if (URL == "") || (strings.Index(URL, ":") == -1) {
|
if (URL == "") || !strings.Contains(URL, ":") {
|
||||||
URL = "http://" + ListenAddr
|
URL = "http://" + ListenAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ func (rev *Revision) hyphaeAffected() (hyphae []string) {
|
|||||||
filesAffected = rev.filesAffected()
|
filesAffected = rev.filesAffected()
|
||||||
)
|
)
|
||||||
for _, filename := range filesAffected {
|
for _, filename := range filesAffected {
|
||||||
if strings.IndexRune(filename, '.') >= 0 {
|
if strings.ContainsRune(filename, '.') {
|
||||||
dotPos := strings.LastIndexByte(filename, '.')
|
dotPos := strings.LastIndexByte(filename, '.')
|
||||||
hyphaName := string([]byte(filename)[0:dotPos]) // is it safe?
|
hyphaName := string([]byte(filename)[0:dotPos]) // is it safe?
|
||||||
if isNewName(hyphaName) {
|
if isNewName(hyphaName) {
|
||||||
|
@ -3,21 +3,11 @@
|
|||||||
"register": "Register",
|
"register": "Register",
|
||||||
"title_search": "Search by title",
|
"title_search": "Search by title",
|
||||||
"admin_panel": "Admin panel",
|
"admin_panel": "Admin panel",
|
||||||
|
|
||||||
"search_results_title": "Search: {{.query}}",
|
|
||||||
"search_results_query": "Search results for ‘{{.query}}’",
|
|
||||||
"search_results_desc": "Every hypha name has been compared with the query. Hyphae that have matched the query are listed below.",
|
|
||||||
|
|
||||||
"backlinks_title": "Backlinks to {{.hypha_name}}",
|
"backlinks_title": "Backlinks to {{.hypha_name}}",
|
||||||
"backlinks_heading": "Backlinks to {{.hypha_link}}",
|
"backlinks_heading": "Backlinks to {{.hypha_link}}",
|
||||||
"backlinks_desc": "Hyphae which have a link to this hypha, embed it as an image or transclude it are listed below.",
|
"backlinks_desc": "Hyphae which have a link to this hypha, embed it as an image or transclude it are listed below.",
|
||||||
|
|
||||||
"list_title": "List of pages",
|
|
||||||
"list_heading": "List of hyphae",
|
|
||||||
"list_desc": "This wiki has {{.n}} %s.",
|
|
||||||
"list_desc+one": "hypha",
|
|
||||||
"list_desc+other": "hyphae",
|
|
||||||
|
|
||||||
"edit_link": "Edit text",
|
"edit_link": "Edit text",
|
||||||
"logout_link": "Log out",
|
"logout_link": "Log out",
|
||||||
"history_link": "View history",
|
"history_link": "View history",
|
||||||
|
@ -118,7 +118,7 @@ func (t Localizer) GetWithLocale(locale, key string, replacements ...*Replacemen
|
|||||||
|
|
||||||
// If the str doesn't have any substitutions, no need to
|
// If the str doesn't have any substitutions, no need to
|
||||||
// template.Execute.
|
// template.Execute.
|
||||||
if strings.Index(str, "}}") == -1 {
|
if strings.Contains(str, "}}") {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ func (t Localizer) GetPlural(key string, n int, replacements ...*Replacements) s
|
|||||||
|
|
||||||
// As in the original, we skip templating if have nothing to replace
|
// As in the original, we skip templating if have nothing to replace
|
||||||
// (however, it's strange case for plurals)
|
// (however, it's strange case for plurals)
|
||||||
if strings.Index(str, "}}") == -1 {
|
if strings.Contains(str, "}}") {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ func (t Localizer) GetPlural64(key string, n int64, replacements ...*Replacement
|
|||||||
|
|
||||||
// As in the original, we skip templating if have nothing to replace
|
// As in the original, we skip templating if have nothing to replace
|
||||||
// (however, it's strange case for plurals)
|
// (however, it's strange case for plurals)
|
||||||
if strings.Index(str, "}}") == -1 {
|
if strings.Contains(str, "}}") {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,21 +3,10 @@
|
|||||||
"register": "Регистрация",
|
"register": "Регистрация",
|
||||||
"title_search": "Поиск по названию",
|
"title_search": "Поиск по названию",
|
||||||
"admin_panel": "Администрирование",
|
"admin_panel": "Администрирование",
|
||||||
|
|
||||||
"search_results_title": "Поиск: {{.query}}",
|
|
||||||
"search_results_query": "Результаты поиска для «{{.query}}»",
|
|
||||||
"search_results_desc": "Название каждой из существующих гиф сопоставлено с запросом. Подходящие гифы приведены ниже.",
|
|
||||||
|
|
||||||
"backlinks_title": "Обратные ссылки на {{.hypha_name}}",
|
"backlinks_title": "Обратные ссылки на {{.hypha_name}}",
|
||||||
"backlinks_heading": "Обратные ссылки на {{.hypha_link}}",
|
"backlinks_heading": "Обратные ссылки на {{.hypha_link}}",
|
||||||
"backlinks_desc": "Ниже перечислены гифы, на которых есть ссылка на эту гифу, трансклюзия этой гифы или эта гифа вставлена как изображение.",
|
"backlinks_desc": "Ниже перечислены гифы, на которых есть ссылка на эту гифу, трансклюзия этой гифы или эта гифа вставлена как изображение.",
|
||||||
|
|
||||||
"list_title": "Список страниц",
|
|
||||||
"list_heading": "Список гиф",
|
|
||||||
"list_desc": "В этой вики {{.n}} %s.",
|
|
||||||
"list_desc+one": "гифа",
|
|
||||||
"list_desc+few": "гифы",
|
|
||||||
"list_desc+many": "гиф",
|
|
||||||
|
|
||||||
"edit_link": "Редактировать",
|
"edit_link": "Редактировать",
|
||||||
"logout_link": "Выйти",
|
"logout_link": "Выйти",
|
||||||
|
@ -7,9 +7,6 @@ import (
|
|||||||
"github.com/bouncepaw/mycorrhiza/user"
|
"github.com/bouncepaw/mycorrhiza/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
func rejectDeleteLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
|
||||||
log.Printf("Reject delete ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
|
||||||
}
|
|
||||||
func rejectRenameLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
func rejectRenameLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
||||||
log.Printf("Reject rename ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
log.Printf("Reject rename ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ func UploadText(h hyphae.Hypha, data []byte, userMessage string, u *user.User) e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: that []byte(...) part should be removed
|
// TODO: that []byte(...) part should be removed
|
||||||
if bytes.Compare(data, []byte(oldText)) == 0 {
|
if bytes.Equal(data, []byte(oldText)) {
|
||||||
// No changes! Just like cancel button
|
// No changes! Just like cancel button
|
||||||
hop.Abort()
|
hop.Abort()
|
||||||
return nil
|
return nil
|
||||||
@ -118,7 +118,7 @@ func UploadText(h hyphae.Hypha, data []byte, userMessage string, u *user.User) e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: that []byte(...) part should be removed
|
// TODO: that []byte(...) part should be removed
|
||||||
if bytes.Compare(data, []byte(oldText)) == 0 {
|
if bytes.Equal(data, []byte(oldText)) {
|
||||||
// No changes! Just like cancel button
|
// No changes! Just like cancel button
|
||||||
hop.Abort()
|
hop.Abort()
|
||||||
return nil
|
return nil
|
||||||
|
@ -71,4 +71,7 @@ func AdminPanel(meta viewutil.Meta) {
|
|||||||
templateAsString(localizedAdminTemplates(meta), "panel title"),
|
templateAsString(localizedAdminTemplates(meta), "panel title"),
|
||||||
buf.String(),
|
buf.String(),
|
||||||
))
|
))
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user