mirror of
https://github.com/usememos/memos.git
synced 2024-12-20 09:41:58 +03:00
chore: make golangci-lint
happy
This commit is contained in:
parent
f784516470
commit
a8a3cf31b4
@ -7,7 +7,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
@ -91,12 +90,12 @@ func (db *DB) Open(ctx context.Context) (err error) {
|
|||||||
minorVersionList := getMinorVersionList()
|
minorVersionList := getMinorVersionList()
|
||||||
|
|
||||||
// backup the raw database file before migration
|
// backup the raw database file before migration
|
||||||
rawBytes, err := ioutil.ReadFile(db.profile.DSN)
|
rawBytes, err := os.ReadFile(db.profile.DSN)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to read raw database file, err: %w", err)
|
return fmt.Errorf("failed to read raw database file, err: %w", err)
|
||||||
}
|
}
|
||||||
backupDBFilePath := fmt.Sprintf("%s/memos_%s_%d_backup.db", db.profile.Data, db.profile.Version, time.Now().Unix())
|
backupDBFilePath := fmt.Sprintf("%s/memos_%s_%d_backup.db", db.profile.Data, db.profile.Version, time.Now().Unix())
|
||||||
if err := ioutil.WriteFile(backupDBFilePath, rawBytes, 0644); err != nil {
|
if err := os.WriteFile(backupDBFilePath, rawBytes, 0644); err != nil {
|
||||||
return fmt.Errorf("failed to write raw database file, err: %w", err)
|
return fmt.Errorf("failed to write raw database file, err: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ type Table struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//lint:ignore U1000 Ignore unused function temporarily for debugging
|
//lint:ignore U1000 Ignore unused function temporarily for debugging
|
||||||
|
//nolint:all
|
||||||
func findTable(ctx context.Context, tx *sql.Tx, tableName string) (*Table, error) {
|
func findTable(ctx context.Context, tx *sql.Tx, tableName string) (*Table, error) {
|
||||||
where, args := []string{"1 = 1"}, []interface{}{}
|
where, args := []string{"1 = 1"}, []interface{}{}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user