aboutsummaryrefslogtreecommitdiffhomepage
path: root/langs
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2020-12-02 13:23:25 +0100
committerBjørn Erik Pedersen <[email protected]>2020-12-03 13:12:58 +0100
commitd90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch)
tree7b1b14464eefec1188ca2eed53c64e4823453cc9 /langs
parent32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff)
downloadhugo-d90e37e0c6e812f9913bf256c9c81aa05b7a08aa.tar.gz
hugo-d90e37e0c6e812f9913bf256c9c81aa05b7a08aa.zip
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'langs')
-rw-r--r--langs/config.go3
-rw-r--r--langs/i18n/i18n.go6
-rw-r--r--langs/i18n/i18n_test.go3
-rw-r--r--langs/i18n/translationProvider.go2
-rw-r--r--langs/language.go2
5 files changed, 1 insertions, 15 deletions
diff --git a/langs/config.go b/langs/config.go
index 3afd15df0..3b1da89ec 100644
--- a/langs/config.go
+++ b/langs/config.go
@@ -35,7 +35,6 @@ type LanguagesConfig struct {
}
func LoadLanguageSettings(cfg config.Provider, oldLangs Languages) (c LanguagesConfig, err error) {
-
defaultLang := strings.ToLower(cfg.GetString("defaultContentLanguage"))
if defaultLang == "" {
defaultLang = "en"
@@ -160,7 +159,6 @@ func LoadLanguageSettings(cfg config.Provider, oldLangs Languages) (c LanguagesC
return c, errors.New("baseURL must be set on all or none of the languages")
}
}
-
}
return c, nil
@@ -172,7 +170,6 @@ func toSortedLanguages(cfg config.Provider, l map[string]interface{}) (Languages
for lang, langConf := range l {
langsMap, err := maps.ToStringMapE(langConf)
-
if err != nil {
return nil, fmt.Errorf("Language config is not a map: %T", langConf)
}
diff --git a/langs/i18n/i18n.go b/langs/i18n/i18n.go
index 31cb5d732..dab620be6 100644
--- a/langs/i18n/i18n.go
+++ b/langs/i18n/i18n.go
@@ -27,9 +27,7 @@ import (
type translateFunc func(translationID string, templateData interface{}) string
-var (
- i18nWarningLogger = helpers.NewDistinctFeedbackLogger()
-)
+var i18nWarningLogger = helpers.NewDistinctFeedbackLogger()
// Translator handles i18n translations.
type Translator struct {
@@ -60,7 +58,6 @@ func (t Translator) Func(lang string) translateFunc {
return func(translationID string, args interface{}) string {
return ""
}
-
}
func (t Translator) initFuncs(bndl *i18n.Bundle) {
@@ -72,7 +69,6 @@ func (t Translator) initFuncs(bndl *i18n.Bundle) {
currentLangKey := strings.ToLower(strings.TrimPrefix(currentLangStr, artificialLangTagPrefix))
localizer := i18n.NewLocalizer(bndl, currentLangStr)
t.translateFuncs[currentLangKey] = func(translationID string, templateData interface{}) string {
-
var pluralCount interface{}
if templateData != nil {
diff --git a/langs/i18n/i18n_test.go b/langs/i18n/i18n_test.go
index fa78f708c..7b5a10d67 100644
--- a/langs/i18n/i18n_test.go
+++ b/langs/i18n/i18n_test.go
@@ -244,7 +244,6 @@ func doTestI18nTranslate(t testing.TB, test i18nTest, cfg config.Provider) strin
tp := prepareTranslationProvider(t, test, cfg)
f := tp.t.Func(test.lang)
return f(test.id, test.args)
-
}
func prepareTranslationProvider(t testing.TB, test i18nTest, cfg config.Provider) *TranslationProvider {
@@ -298,7 +297,6 @@ func getConfig() *viper.Viper {
v.Set("allModules", modules.Modules{mod})
return v
-
}
func TestI18nTranslate(t *testing.T) {
@@ -339,5 +337,4 @@ func BenchmarkI18nTranslate(b *testing.B) {
}
})
}
-
}
diff --git a/langs/i18n/translationProvider.go b/langs/i18n/translationProvider.go
index 07bd9219a..302ca84c6 100644
--- a/langs/i18n/translationProvider.go
+++ b/langs/i18n/translationProvider.go
@@ -73,7 +73,6 @@ func (tp *TranslationProvider) Update(d *deps.Deps) error {
d.Translate = tp.t.Func(d.Language.Lang)
return nil
-
}
const artificialLangTagPrefix = "art-x-"
@@ -138,5 +137,4 @@ func errWithFileContext(inerr error, r source.File) error {
herrors.SimpleLineMatcher)
return err
-
}
diff --git a/langs/language.go b/langs/language.go
index 874bd3020..9fa22b05a 100644
--- a/langs/language.go
+++ b/langs/language.go
@@ -122,7 +122,6 @@ func (l Languages) Less(i, j int) bool {
}
return wj == 0 || wi < wj
-
}
func (l Languages) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
@@ -256,5 +255,4 @@ func (l *Language) IsSet(key string) bool {
}
}
return l.Cfg.IsSet(key)
-
}