From 06312783a286433b3de8515666392f6d866176de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dario=20Casta=C3=B1=C3=A9?= Date: Tue, 16 Jan 2024 08:20:12 +0100 Subject: [PATCH] general: gofumpt & gci --- constants.go | 50 ++++++++++++++++++++++++++------------------------ generate.go | 12 +++++------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/constants.go b/constants.go index 38d9c94..6cdc068 100644 --- a/constants.go +++ b/constants.go @@ -25,27 +25,29 @@ import ( "golang.org/x/text/language" ) -var ZAS = "zas" -var ZAS_PREFIX = "zs" -var ZAS_NAME = cases.Title(language.English).String(ZAS) -var ZAS_DIR = fmt.Sprintf(".%s", ZAS) -var ZAS_CONF_FILE = filepath.Join(ZAS_DIR, "config.yml") -var ZAS_I18N_FILE = filepath.Join(ZAS_DIR, "i18n.yml") -var ZAS_DIR_CONF_FILE = fmt.Sprintf(".%s.yml", ZAS) -var ZAS_DEFAULT_DIR_PERM = 0755 -var ZAS_DEFAULT_FILE_PERM = 0644 -var ZAS_DEFAULT_CONF = ConfigSection{ - ZAS: ConfigSection{ - "layout": filepath.Join(ZAS_DIR, "layout.html"), - "deploy": filepath.Join(ZAS_DIR, "deploy"), - }, - "site": ConfigSection{ - "baseurl": "http://example.com", - "language": "en", - }, - "mimetypes": ConfigSection{ - "text/markdown": "markdown", - "text/plain": "plain", - "text/html": "html", - }, -} +var ( + ZAS = "zas" + ZAS_PREFIX = "zs" + ZAS_NAME = cases.Title(language.English).String(ZAS) + ZAS_DIR = fmt.Sprintf(".%s", ZAS) + ZAS_CONF_FILE = filepath.Join(ZAS_DIR, "config.yml") + ZAS_I18N_FILE = filepath.Join(ZAS_DIR, "i18n.yml") + ZAS_DIR_CONF_FILE = fmt.Sprintf(".%s.yml", ZAS) + ZAS_DEFAULT_DIR_PERM = 0o755 + ZAS_DEFAULT_FILE_PERM = 0o644 + ZAS_DEFAULT_CONF = ConfigSection{ + ZAS: ConfigSection{ + "layout": filepath.Join(ZAS_DIR, "layout.html"), + "deploy": filepath.Join(ZAS_DIR, "deploy"), + }, + "site": ConfigSection{ + "baseurl": "http://example.com", + "language": "en", + }, + "mimetypes": ConfigSection{ + "text/markdown": "markdown", + "text/plain": "plain", + "text/html": "html", + }, + } +) diff --git a/generate.go b/generate.go index 07311cd..5b80b30 100644 --- a/generate.go +++ b/generate.go @@ -40,12 +40,10 @@ import ( yaml "gopkg.in/yaml.v2" ) -var ( - helpers = thtml.FuncMap{ - "noescape": noescape, - "eq": eq, - } -) +var helpers = thtml.FuncMap{ + "noescape": noescape, + "eq": eq, +} /* * Convenience type to group relevant rendering info. @@ -466,7 +464,7 @@ func (gen *Generator) extractPageConfig(doc *goquery.Document) (config map[inter /* * Copies a file. */ -func (gen *Generator) copy(dstPath string, srcPath string) (err error) { +func (gen *Generator) copy(dstPath, srcPath string) (err error) { src, err := os.Open(srcPath) if err != nil { return