mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-09 22:38:08 -06:00
Enable stricter linting with golangci-lint (#316)
* update golangci-lint * add golangci config file w/ more linters * correct issues flagged by stricter linters * add more generous timeout for golangci-lint * add some style + formatting guidelines * move timeout to config file * go fmt
This commit is contained in:
parent
38d73f0316
commit
f8630348b4
47 changed files with 227 additions and 163 deletions
|
|
@ -54,7 +54,7 @@ const (
|
|||
dbTypeSqlite = "sqlite"
|
||||
)
|
||||
|
||||
var registerTables []interface{} = []interface{}{
|
||||
var registerTables = []interface{}{
|
||||
>smodel.StatusToEmoji{},
|
||||
>smodel.StatusToTag{},
|
||||
}
|
||||
|
|
@ -220,7 +220,7 @@ func sqliteConn(ctx context.Context, c *config.Config) (*DBConn, error) {
|
|||
}
|
||||
|
||||
tweakConnectionValues(sqldb)
|
||||
|
||||
|
||||
if c.DBConfig.Address == "file::memory:?cache=shared" {
|
||||
logrus.Warn("sqlite in-memory database should only be used for debugging")
|
||||
// don't close connections on disconnect -- otherwise
|
||||
|
|
@ -248,11 +248,11 @@ func pgConn(ctx context.Context, c *config.Config) (*DBConn, error) {
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("could not create bundb postgres options: %s", err)
|
||||
}
|
||||
|
||||
|
||||
sqldb := stdlib.OpenDB(*opts)
|
||||
|
||||
|
||||
tweakConnectionValues(sqldb)
|
||||
|
||||
|
||||
conn := WrapDBConn(bun.NewDB(sqldb, pgdialect.New()))
|
||||
|
||||
// ping to check the db is there and listening
|
||||
|
|
@ -305,6 +305,7 @@ func deriveBunDBPGOptions(c *config.Config) (*pgx.ConnConfig, error) {
|
|||
case config.DBTLSModeDisable, config.DBTLSModeUnset:
|
||||
break // nothing to do
|
||||
case config.DBTLSModeEnable:
|
||||
/* #nosec G402 */
|
||||
tlsConfig = &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
}
|
||||
|
|
@ -312,6 +313,7 @@ func deriveBunDBPGOptions(c *config.Config) (*pgx.ConnConfig, error) {
|
|||
tlsConfig = &tls.Config{
|
||||
InsecureSkipVerify: false,
|
||||
ServerName: c.DBConfig.Address,
|
||||
MinVersion: tls.VersionTLS12,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue