From f0d6639ed3223d9f4fe97eebf860dd5e77132967 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 12 Jan 2025 17:18:51 +0800 Subject: Reformat code --- config.go | 12 +++++++----- errors.go | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config.go b/config.go index d1c86a0..5098d2c 100644 --- a/config.go +++ b/config.go @@ -7,8 +7,8 @@ import ( "os" "sync" - "go.lindenii.runxiyu.org/lindenii-common/scfg" "github.com/jackc/pgx/v5/pgxpool" + "go.lindenii.runxiyu.org/lindenii-common/scfg" ) var config struct { @@ -18,14 +18,16 @@ var config struct { Cert string `scfg:"cert"` Key string `scfg:"key"` } `scfg:"tls"` - DB struct { + DB struct { Type string `scfg:"type"` Conn string `scfg:"conn"` } `scfg:"db"` _tls_config *tls.Config } -var config_mutex sync.RWMutex // covers things like the database too -var db *pgxpool.Pool +var ( + config_mutex sync.RWMutex // covers things like the database too + db *pgxpool.Pool +) // load_config loads the configuration file and sets up global things according // to the configuration directives. @@ -50,7 +52,7 @@ func load_config(path string) error { } config._tls_config = &tls.Config{ Certificates: []tls.Certificate{cer}, - MinVersion: tls.VersionTLS13, + MinVersion: tls.VersionTLS13, } // Database setup diff --git a/errors.go b/errors.go index da4d028..b34e3a2 100644 --- a/errors.go +++ b/errors.go @@ -4,5 +4,7 @@ import ( "errors" ) -var err_deliver_write = errors.New("unable to write to filesystem while attempting to deliver message") -var err_unsupported_database_type = errors.New("unsupported database type; only \"postgres\" is currently supported") +var ( + err_deliver_write = errors.New("unable to write to filesystem while attempting to deliver message") + err_unsupported_database_type = errors.New("unsupported database type; only \"postgres\" is currently supported") +) -- cgit v1.2.3