From 965b515db400d0366b13520ea94e1dee633dca1c Mon Sep 17 00:00:00 2001 From: f0x Date: Sat, 19 Jun 2021 00:25:43 +0200 Subject: [PATCH] run go fmt --- internal/config/config.go | 8 ++++---- internal/config/default.go | 6 +++--- internal/config/template.go | 2 +- internal/db/pg/pg.go | 6 +++--- internal/router/router.go | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 72543a1..b0263b1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -288,7 +288,7 @@ type Flags struct { DbDatabase string TemplateBaseDir string - AssetBaseDir string + AssetBaseDir string AccountsOpenRegistration string AccountsApprovalRequired string @@ -332,7 +332,7 @@ type Defaults struct { DbDatabase string TemplateBaseDir string - AssetBaseDir string + AssetBaseDir string AccountsOpenRegistration bool AccountsRequireApproval bool @@ -378,7 +378,7 @@ func GetFlagNames() Flags { DbDatabase: "db-database", TemplateBaseDir: "template-basedir", - AssetBaseDir: "asset-basedir", + AssetBaseDir: "asset-basedir", AccountsOpenRegistration: "accounts-open-registration", AccountsApprovalRequired: "accounts-approval-required", @@ -425,7 +425,7 @@ func GetEnvNames() Flags { DbDatabase: "GTS_DB_DATABASE", TemplateBaseDir: "GTS_TEMPLATE_BASEDIR", - AssetBaseDir: "GTS_ASSET_BASEDIR", + AssetBaseDir: "GTS_ASSET_BASEDIR", AccountsOpenRegistration: "GTS_ACCOUNTS_OPEN_REGISTRATION", AccountsApprovalRequired: "GTS_ACCOUNTS_APPROVAL_REQUIRED", diff --git a/internal/config/default.go b/internal/config/default.go index 7ac60c2..8a53f23 100644 --- a/internal/config/default.go +++ b/internal/config/default.go @@ -18,7 +18,7 @@ func TestDefault() *Config { ApplicationName: defaults.ApplicationName, }, TemplateConfig: &TemplateConfig{ - BaseDir: defaults.TemplateBaseDir, + BaseDir: defaults.TemplateBaseDir, AssetBaseDir: defaults.AssetBaseDir, }, AccountsConfig: &AccountsConfig{ @@ -72,7 +72,7 @@ func Default() *Config { ApplicationName: defaults.ApplicationName, }, TemplateConfig: &TemplateConfig{ - BaseDir: defaults.TemplateBaseDir, + BaseDir: defaults.TemplateBaseDir, AssetBaseDir: defaults.AssetBaseDir, }, AccountsConfig: &AccountsConfig{ @@ -126,7 +126,7 @@ func GetDefaults() Defaults { DbDatabase: "postgres", TemplateBaseDir: "./web/template/", - AssetBaseDir: "./web/assets/", + AssetBaseDir: "./web/assets/", AccountsOpenRegistration: true, AccountsRequireApproval: true, diff --git a/internal/config/template.go b/internal/config/template.go index 4af7290..9c52447 100644 --- a/internal/config/template.go +++ b/internal/config/template.go @@ -22,6 +22,6 @@ package config type TemplateConfig struct { // Directory from which gotosocial will attempt to load html templates (.tmpl files). BaseDir string `yaml:"baseDir"` - // Directory from which static files are served + // Directory from which static files are served AssetBaseDir string `yaml:"assetDir"` } diff --git a/internal/db/pg/pg.go b/internal/db/pg/pg.go index 8515013..887df92 100644 --- a/internal/db/pg/pg.go +++ b/internal/db/pg/pg.go @@ -810,7 +810,7 @@ func (ps *postgresService) Follows(sourceAccount *gtsmodel.Account, targetAccoun if sourceAccount == nil || targetAccount == nil { return false, nil } - + return ps.conn.Model(>smodel.Follow{}).Where("account_id = ?", sourceAccount.ID).Where("target_account_id = ?", targetAccount.ID).Exists() } @@ -818,7 +818,7 @@ func (ps *postgresService) FollowRequested(sourceAccount *gtsmodel.Account, targ if sourceAccount == nil || targetAccount == nil { return false, nil } - + return ps.conn.Model(>smodel.FollowRequest{}).Where("account_id = ?", sourceAccount.ID).Where("target_account_id = ?", targetAccount.ID).Exists() } @@ -826,7 +826,7 @@ func (ps *postgresService) Mutuals(account1 *gtsmodel.Account, account2 *gtsmode if account1 == nil || account2 == nil { return false, nil } - + // make sure account 1 follows account 2 f1, err := ps.conn.Model(>smodel.Follow{}).Where("account_id = ?", account1.ID).Where("target_account_id = ?", account2.ID).Exists() if err != nil { diff --git a/internal/router/router.go b/internal/router/router.go index 3872138..ea8bc7b 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -154,18 +154,18 @@ func New(config *config.Config, logger *logrus.Logger) (Router, error) { // serve static files from /assets // FIXME: why doesn't this config var work?? // assetPath := filepath.Join(cwd, config.TemplateConfig.AssetBaseDir); - engine.Static("/assets", "./web/assets"); + engine.Static("/assets", "./web/assets") // FIXME: actual variables engine.GET("/", func(c *gin.Context) { c.HTML(http.StatusOK, "index.tmpl", gin.H{ - "instancename": "GoToSocial Test Instance", - "countUsers": 3, + "instancename": "GoToSocial Test Instance", + "countUsers": 3, "countStatuses": 42069, - "version": "1.0.0", + "version": "1.0.0", "adminUsername": "@admin", }) - }); + }) // create the actual http server here s := &http.Server{