Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
tbuchaillot authored Jan 17, 2025
1 parent 460f0fc commit cdfe526
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions resource/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@ func (res *Resource) saveHandler(result interface{}, context *qor.Context) error
if !res.HasPermission(roles.Create, context) {
return roles.ErrPermissionDenied
}

Check failure on line 147 in resource/crud.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofmt`-ed with `-s` (gofmt)
return context.GetDB().Create(result).Error
}

// If we have a non-zero primary key, first check if it exists
var count int

primaryField := scope.PrimaryField()
if primaryField == nil {
return fmt.Errorf("no primary key field found")
Expand All @@ -164,9 +166,11 @@ func (res *Resource) saveHandler(result interface{}, context *qor.Context) error
if count > 0 {
return fmt.Errorf("record with primary key %v already exists", scope.PrimaryKeyValue())
}

if !res.HasPermission(roles.Create, context) {
return roles.ErrPermissionDenied
}

Check failure on line 173 in resource/crud.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed with `-extra` (gofumpt)
return context.GetDB().Create(result).Error
}

Expand Down

0 comments on commit cdfe526

Please sign in to comment.