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
9107a941
Commit
9107a941
authored
Feb 24, 2025
by
Johnny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update linter config
parent
f98c5198
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
17 deletions
+19
-17
.golangci.yaml
.golangci.yaml
+2
-0
util.go
internal/util/util.go
+2
-2
parser.go
plugin/cron/parser.go
+7
-7
idp.go
store/idp.go
+3
-3
memo_relation.go
store/memo_relation.go
+2
-2
resource.go
store/resource.go
+3
-3
No files found.
.golangci.yaml
View file @
9107a941
...
...
@@ -71,6 +71,8 @@ linters-settings:
disabled
:
true
-
name
:
max-control-nesting
disabled
:
true
-
name
:
redefines-builtin-id
disabled
:
true
gocritic
:
disabled-checks
:
-
ifElseChain
...
...
internal/util/util.go
View file @
9107a941
...
...
@@ -63,10 +63,10 @@ func RandomString(n int) (string, error) {
}
// ReplaceString replaces all occurrences of old in slice with new.
func
ReplaceString
(
slice
[]
string
,
old
,
new
Str
string
)
[]
string
{
func
ReplaceString
(
slice
[]
string
,
old
,
new
string
)
[]
string
{
for
i
,
s
:=
range
slice
{
if
s
==
old
{
slice
[
i
]
=
new
Str
slice
[
i
]
=
new
}
}
return
slice
...
...
plugin/cron/parser.go
View file @
9107a941
...
...
@@ -173,24 +173,24 @@ func normalizeFields(fields []string, options ParseOption) ([]string, error) {
}
// Figure out how many fields we need
max
imumValue
:=
0
max
:=
0
for
_
,
place
:=
range
places
{
if
options
&
place
>
0
{
max
imumValue
++
max
++
}
}
min
imumValue
:=
maximumValue
-
optionals
min
:=
max
-
optionals
// Validate number of fields
if
count
:=
len
(
fields
);
count
<
min
imumValue
||
count
>
maximumValue
{
if
min
imumValue
==
maximumValue
{
if
count
:=
len
(
fields
);
count
<
min
||
count
>
max
{
if
min
==
max
{
return
nil
,
errors
.
New
(
"incorrect number of fields"
)
}
return
nil
,
errors
.
New
(
"incorrect number of fields, expected "
+
strconv
.
Itoa
(
min
imumValue
)
+
"-"
+
strconv
.
Itoa
(
maximumValue
))
return
nil
,
errors
.
New
(
"incorrect number of fields, expected "
+
strconv
.
Itoa
(
min
)
+
"-"
+
strconv
.
Itoa
(
max
))
}
// Populate the optional field if not provided
if
min
imumValue
<
maximumValue
&&
len
(
fields
)
==
minimumValue
{
if
min
<
max
&&
len
(
fields
)
==
min
{
switch
{
case
options
&
DowOptional
>
0
:
fields
=
append
(
fields
,
defaults
[
5
])
// TODO: improve access to default
...
...
store/idp.go
View file @
9107a941
...
...
@@ -131,13 +131,13 @@ func (s *Store) UpdateIdentityProvider(ctx context.Context, update *UpdateIdenti
return
identityProvider
,
nil
}
func
(
s
*
Store
)
DeleteIdentityProvider
(
ctx
context
.
Context
,
delete
Idp
*
DeleteIdentityProvider
)
error
{
err
:=
s
.
driver
.
DeleteIdentityProvider
(
ctx
,
delete
Idp
)
func
(
s
*
Store
)
DeleteIdentityProvider
(
ctx
context
.
Context
,
delete
*
DeleteIdentityProvider
)
error
{
err
:=
s
.
driver
.
DeleteIdentityProvider
(
ctx
,
delete
)
if
err
!=
nil
{
return
err
}
s
.
idpCache
.
Delete
(
delete
Idp
.
ID
)
s
.
idpCache
.
Delete
(
delete
.
ID
)
return
nil
}
...
...
store/memo_relation.go
View file @
9107a941
...
...
@@ -39,6 +39,6 @@ func (s *Store) ListMemoRelations(ctx context.Context, find *FindMemoRelation) (
return
s
.
driver
.
ListMemoRelations
(
ctx
,
find
)
}
func
(
s
*
Store
)
DeleteMemoRelation
(
ctx
context
.
Context
,
delete
MR
*
DeleteMemoRelation
)
error
{
return
s
.
driver
.
DeleteMemoRelation
(
ctx
,
delete
MR
)
func
(
s
*
Store
)
DeleteMemoRelation
(
ctx
context
.
Context
,
delete
*
DeleteMemoRelation
)
error
{
return
s
.
driver
.
DeleteMemoRelation
(
ctx
,
delete
)
}
store/resource.go
View file @
9107a941
...
...
@@ -97,8 +97,8 @@ func (s *Store) UpdateResource(ctx context.Context, update *UpdateResource) erro
return
s
.
driver
.
UpdateResource
(
ctx
,
update
)
}
func
(
s
*
Store
)
DeleteResource
(
ctx
context
.
Context
,
delete
Resource
*
DeleteResource
)
error
{
resource
,
err
:=
s
.
GetResource
(
ctx
,
&
FindResource
{
ID
:
&
delete
Resource
.
ID
})
func
(
s
*
Store
)
DeleteResource
(
ctx
context
.
Context
,
delete
*
DeleteResource
)
error
{
resource
,
err
:=
s
.
GetResource
(
ctx
,
&
FindResource
{
ID
:
&
delete
.
ID
})
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"failed to get resource"
)
}
...
...
@@ -151,5 +151,5 @@ func (s *Store) DeleteResource(ctx context.Context, deleteResource *DeleteResour
}
}
return
s
.
driver
.
DeleteResource
(
ctx
,
delete
Resource
)
return
s
.
driver
.
DeleteResource
(
ctx
,
delete
)
}
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