Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
a8a3cf31
Commit
a8a3cf31
authored
Aug 24, 2022
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: make `golangci-lint` happy
parent
f7845164
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
db.go
store/db/db.go
+2
-3
table.go
store/db/table.go
+1
-0
No files found.
store/db/db.go
View file @
a8a3cf31
...
@@ -7,7 +7,6 @@ import (
...
@@ -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) {
...
@@ -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
)
}
}
...
...
store/db/table.go
View file @
a8a3cf31
...
@@ -12,6 +12,7 @@ type Table struct {
...
@@ -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
{}{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment