Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
756da8a1
Unverified
Commit
756da8a1
authored
May 17, 2019
by
Oleg Gaidarenko
Committed by
GitHub
May 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: tighten revive exit code & make it happy (#17127)
* Revive should fail the build * Fix the associated errors
parent
0a9863a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
pkg/services/sqlstore/transactions.go
+5
-5
scripts/go/configs/revive.toml
+1
-1
No files found.
pkg/services/sqlstore/transactions.go
View file @
756da8a1
...
...
@@ -12,7 +12,7 @@ import (
// WithTransactionalDbSession calls the callback with an session within a transaction
func
(
ss
*
SqlStore
)
WithTransactionalDbSession
(
ctx
context
.
Context
,
callback
dbTransactionFunc
)
error
{
return
inTransactionWithRetryCtx
(
ss
.
engine
,
ctx
,
callback
,
0
)
return
inTransactionWithRetryCtx
(
ctx
,
ss
.
engine
,
callback
,
0
)
}
func
(
ss
*
SqlStore
)
InTransaction
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
)
error
{
...
...
@@ -20,17 +20,17 @@ func (ss *SqlStore) InTransaction(ctx context.Context, fn func(ctx context.Conte
}
func
(
ss
*
SqlStore
)
inTransactionWithRetry
(
ctx
context
.
Context
,
fn
func
(
ctx
context
.
Context
)
error
,
retry
int
)
error
{
return
inTransactionWithRetryCtx
(
ss
.
engine
,
ctx
,
func
(
sess
*
DBSession
)
error
{
return
inTransactionWithRetryCtx
(
ctx
,
ss
.
engine
,
func
(
sess
*
DBSession
)
error
{
withValue
:=
context
.
WithValue
(
ctx
,
ContextSessionName
,
sess
)
return
fn
(
withValue
)
},
retry
)
}
func
inTransactionWithRetry
(
callback
dbTransactionFunc
,
retry
int
)
error
{
return
inTransactionWithRetryCtx
(
x
,
context
.
Background
()
,
callback
,
retry
)
return
inTransactionWithRetryCtx
(
context
.
Background
(),
x
,
callback
,
retry
)
}
func
inTransactionWithRetryCtx
(
engine
*
xorm
.
Engine
,
ctx
context
.
Context
,
callback
dbTransactionFunc
,
retry
int
)
error
{
func
inTransactionWithRetryCtx
(
ctx
context
.
Context
,
engine
*
xorm
.
Engine
,
callback
dbTransactionFunc
,
retry
int
)
error
{
sess
,
err
:=
startSession
(
ctx
,
engine
,
true
)
if
err
!=
nil
{
return
err
...
...
@@ -73,5 +73,5 @@ func inTransaction(callback dbTransactionFunc) error {
}
func
inTransactionCtx
(
ctx
context
.
Context
,
callback
dbTransactionFunc
)
error
{
return
inTransactionWithRetryCtx
(
x
,
ct
x
,
callback
,
0
)
return
inTransactionWithRetryCtx
(
ctx
,
x
,
callback
,
0
)
}
scripts/go/configs/revive.toml
View file @
756da8a1
ignoreGeneratedHeader
=
false
severity
=
"error"
confidence
=
0.8
errorCode
=
0
errorCode
=
1
[rule.context-as-argument]
[rule.error-return]
...
...
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