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
0a936a55
Commit
0a936a55
authored
Jan 07, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed new gometalinter issues
parent
cfa3e05e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
33 deletions
+24
-33
pkg/components/dashdiffs/formatter_json.go
+20
-29
pkg/services/sqlstore/login_attempt.go
+4
-4
No files found.
pkg/components/dashdiffs/formatter_json.go
View file @
0a936a55
...
@@ -206,10 +206,9 @@ func (f *JSONFormatter) processObject(object map[string]interface{}, deltas []di
...
@@ -206,10 +206,9 @@ func (f *JSONFormatter) processObject(object map[string]interface{}, deltas []di
// Added
// Added
for
_
,
delta
:=
range
deltas
{
for
_
,
delta
:=
range
deltas
{
switch
delta
.
(
type
)
{
switch
delta
:=
delta
.
(
type
)
{
case
*
diff
.
Added
:
case
*
diff
.
Added
:
d
:=
delta
.
(
*
diff
.
Added
)
f
.
printRecursive
(
delta
.
Position
.
String
(),
delta
.
Value
,
ChangeAdded
)
f
.
printRecursive
(
d
.
Position
.
String
(),
d
.
Value
,
ChangeAdded
)
}
}
}
}
...
@@ -222,9 +221,8 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
...
@@ -222,9 +221,8 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
if
len
(
matchedDeltas
)
>
0
{
if
len
(
matchedDeltas
)
>
0
{
for
_
,
matchedDelta
:=
range
matchedDeltas
{
for
_
,
matchedDelta
:=
range
matchedDeltas
{
switch
matchedDelta
.
(
type
)
{
switch
matchedDelta
:=
matchedDelta
.
(
type
)
{
case
*
diff
.
Object
:
case
*
diff
.
Object
:
d
:=
matchedDelta
.
(
*
diff
.
Object
)
switch
value
.
(
type
)
{
switch
value
.
(
type
)
{
case
map
[
string
]
interface
{}
:
case
map
[
string
]
interface
{}
:
//ok
//ok
...
@@ -238,7 +236,7 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
...
@@ -238,7 +236,7 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
f
.
print
(
"{"
)
f
.
print
(
"{"
)
f
.
closeLine
()
f
.
closeLine
()
f
.
push
(
positionStr
,
len
(
o
),
false
)
f
.
push
(
positionStr
,
len
(
o
),
false
)
f
.
processObject
(
o
,
d
.
Deltas
)
f
.
processObject
(
o
,
matchedDelta
.
Deltas
)
f
.
pop
()
f
.
pop
()
f
.
newLine
(
ChangeNil
)
f
.
newLine
(
ChangeNil
)
f
.
print
(
"}"
)
f
.
print
(
"}"
)
...
@@ -246,7 +244,6 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
...
@@ -246,7 +244,6 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
f
.
closeLine
()
f
.
closeLine
()
case
*
diff
.
Array
:
case
*
diff
.
Array
:
d
:=
matchedDelta
.
(
*
diff
.
Array
)
switch
value
.
(
type
)
{
switch
value
.
(
type
)
{
case
[]
interface
{}
:
case
[]
interface
{}
:
//ok
//ok
...
@@ -260,7 +257,7 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
...
@@ -260,7 +257,7 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
f
.
print
(
"["
)
f
.
print
(
"["
)
f
.
closeLine
()
f
.
closeLine
()
f
.
push
(
positionStr
,
len
(
a
),
true
)
f
.
push
(
positionStr
,
len
(
a
),
true
)
f
.
processArray
(
a
,
d
.
Deltas
)
f
.
processArray
(
a
,
matchedDelta
.
Deltas
)
f
.
pop
()
f
.
pop
()
f
.
newLine
(
ChangeNil
)
f
.
newLine
(
ChangeNil
)
f
.
print
(
"]"
)
f
.
print
(
"]"
)
...
@@ -268,27 +265,23 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
...
@@ -268,27 +265,23 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
f
.
closeLine
()
f
.
closeLine
()
case
*
diff
.
Added
:
case
*
diff
.
Added
:
d
:=
matchedDelta
.
(
*
diff
.
Added
)
f
.
printRecursive
(
positionStr
,
matchedDelta
.
Value
,
ChangeAdded
)
f
.
printRecursive
(
positionStr
,
d
.
Value
,
ChangeAdded
)
f
.
size
[
len
(
f
.
size
)
-
1
]
++
f
.
size
[
len
(
f
.
size
)
-
1
]
++
case
*
diff
.
Modified
:
case
*
diff
.
Modified
:
d
:=
matchedDelta
.
(
*
diff
.
Modified
)
savedSize
:=
f
.
size
[
len
(
f
.
size
)
-
1
]
savedSize
:=
f
.
size
[
len
(
f
.
size
)
-
1
]
f
.
printRecursive
(
positionStr
,
d
.
OldValue
,
ChangeOld
)
f
.
printRecursive
(
positionStr
,
matchedDelta
.
OldValue
,
ChangeOld
)
f
.
size
[
len
(
f
.
size
)
-
1
]
=
savedSize
f
.
size
[
len
(
f
.
size
)
-
1
]
=
savedSize
f
.
printRecursive
(
positionStr
,
d
.
NewValue
,
ChangeNew
)
f
.
printRecursive
(
positionStr
,
matchedDelta
.
NewValue
,
ChangeNew
)
case
*
diff
.
TextDiff
:
case
*
diff
.
TextDiff
:
savedSize
:=
f
.
size
[
len
(
f
.
size
)
-
1
]
savedSize
:=
f
.
size
[
len
(
f
.
size
)
-
1
]
d
:=
matchedDelta
.
(
*
diff
.
TextDiff
)
f
.
printRecursive
(
positionStr
,
matchedDelta
.
OldValue
,
ChangeOld
)
f
.
printRecursive
(
positionStr
,
d
.
OldValue
,
ChangeOld
)
f
.
size
[
len
(
f
.
size
)
-
1
]
=
savedSize
f
.
size
[
len
(
f
.
size
)
-
1
]
=
savedSize
f
.
printRecursive
(
positionStr
,
d
.
NewValue
,
ChangeNew
)
f
.
printRecursive
(
positionStr
,
matchedDelta
.
NewValue
,
ChangeNew
)
case
*
diff
.
Deleted
:
case
*
diff
.
Deleted
:
d
:=
matchedDelta
.
(
*
diff
.
Deleted
)
f
.
printRecursive
(
positionStr
,
matchedDelta
.
Value
,
ChangeDeleted
)
f
.
printRecursive
(
positionStr
,
d
.
Value
,
ChangeDeleted
)
default
:
default
:
return
errors
.
New
(
"Unknown Delta type detected"
)
return
errors
.
New
(
"Unknown Delta type detected"
)
...
@@ -305,13 +298,13 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
...
@@ -305,13 +298,13 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
func
(
f
*
JSONFormatter
)
searchDeltas
(
deltas
[]
diff
.
Delta
,
position
diff
.
Position
)
(
results
[]
diff
.
Delta
)
{
func
(
f
*
JSONFormatter
)
searchDeltas
(
deltas
[]
diff
.
Delta
,
position
diff
.
Position
)
(
results
[]
diff
.
Delta
)
{
results
=
make
([]
diff
.
Delta
,
0
)
results
=
make
([]
diff
.
Delta
,
0
)
for
_
,
delta
:=
range
deltas
{
for
_
,
delta
:=
range
deltas
{
switch
delta
.
(
type
)
{
switch
typedDelta
:=
delta
.
(
type
)
{
case
diff
.
PostDelta
:
case
diff
.
PostDelta
:
if
delta
.
(
diff
.
PostDelta
)
.
PostPosition
()
==
position
{
if
typedDelta
.
PostPosition
()
==
position
{
results
=
append
(
results
,
delta
)
results
=
append
(
results
,
delta
)
}
}
case
diff
.
PreDelta
:
case
diff
.
PreDelta
:
if
delta
.
(
diff
.
PreDelta
)
.
PrePosition
()
==
position
{
if
typedDelta
.
PrePosition
()
==
position
{
results
=
append
(
results
,
delta
)
results
=
append
(
results
,
delta
)
}
}
default
:
default
:
...
@@ -417,20 +410,19 @@ func (f *JSONFormatter) print(a string) {
...
@@ -417,20 +410,19 @@ func (f *JSONFormatter) print(a string) {
}
}
func
(
f
*
JSONFormatter
)
printRecursive
(
name
string
,
value
interface
{},
change
ChangeType
)
{
func
(
f
*
JSONFormatter
)
printRecursive
(
name
string
,
value
interface
{},
change
ChangeType
)
{
switch
value
.
(
type
)
{
switch
value
:=
value
.
(
type
)
{
case
map
[
string
]
interface
{}
:
case
map
[
string
]
interface
{}
:
f
.
newLine
(
change
)
f
.
newLine
(
change
)
f
.
printKey
(
name
)
f
.
printKey
(
name
)
f
.
print
(
"{"
)
f
.
print
(
"{"
)
f
.
closeLine
()
f
.
closeLine
()
m
:=
value
.
(
map
[
string
]
interface
{})
size
:=
len
(
value
)
size
:=
len
(
m
)
f
.
push
(
name
,
size
,
false
)
f
.
push
(
name
,
size
,
false
)
keys
:=
sortKeys
(
m
)
keys
:=
sortKeys
(
value
)
for
_
,
key
:=
range
keys
{
for
_
,
key
:=
range
keys
{
f
.
printRecursive
(
key
,
m
[
key
],
change
)
f
.
printRecursive
(
key
,
value
[
key
],
change
)
}
}
f
.
pop
()
f
.
pop
()
...
@@ -445,10 +437,9 @@ func (f *JSONFormatter) printRecursive(name string, value interface{}, change Ch
...
@@ -445,10 +437,9 @@ func (f *JSONFormatter) printRecursive(name string, value interface{}, change Ch
f
.
print
(
"["
)
f
.
print
(
"["
)
f
.
closeLine
()
f
.
closeLine
()
s
:=
value
.
([]
interface
{})
size
:=
len
(
value
)
size
:=
len
(
s
)
f
.
push
(
""
,
size
,
true
)
f
.
push
(
""
,
size
,
true
)
for
_
,
item
:=
range
s
{
for
_
,
item
:=
range
value
{
f
.
printRecursive
(
""
,
item
,
change
)
f
.
printRecursive
(
""
,
item
,
change
)
}
}
f
.
pop
()
f
.
pop
()
...
...
pkg/services/sqlstore/login_attempt.go
View file @
0a936a55
...
@@ -78,14 +78,14 @@ func GetUserLoginAttemptCount(query *m.GetUserLoginAttemptCountQuery) error {
...
@@ -78,14 +78,14 @@ func GetUserLoginAttemptCount(query *m.GetUserLoginAttemptCountQuery) error {
}
}
func
toInt64
(
i
interface
{})
int64
{
func
toInt64
(
i
interface
{})
int64
{
switch
i
.
(
type
)
{
switch
i
:=
i
.
(
type
)
{
case
[]
byte
:
case
[]
byte
:
n
,
_
:=
strconv
.
ParseInt
(
string
(
i
.
([]
byte
)
),
10
,
64
)
n
,
_
:=
strconv
.
ParseInt
(
string
(
i
),
10
,
64
)
return
n
return
n
case
int
:
case
int
:
return
int64
(
i
.
(
int
)
)
return
int64
(
i
)
case
int64
:
case
int64
:
return
i
.
(
int64
)
return
i
}
}
return
0
return
0
}
}
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