fix(all): resolve go critic issues

This commit is contained in:
Tit Petric
2018-08-27 13:55:48 +02:00
parent 257219d5f5
commit daf92fd947
5 changed files with 14 additions and 10 deletions
+3 -1
View File
@@ -29,10 +29,12 @@ func Init() error {
if err != nil {
return err
}
// @todo: profiling as an external service?
switch config.db.profiler {
case "stdout":
db.Profiler = &factory.Database.ProfilerStdout
// @todo: profiling as an external service?
default:
fmt.Println("No database query profiler selected")
}
// configure resputil options
+4 -4
View File
@@ -22,10 +22,10 @@ type (
Get(resourceID string) (*types.Resource, error)
Delete(resourceID string) error
Grant(resourceID string, rolepath string, operations []string) error
Grant(resourceID, rolepath string, operations []string) error
GrantMultiple(resourceID string, roles []ResourcesRole) error
CheckAccess(resourceID string, operation string, sessionID string) error
CheckAccess(resourceID, operation, sessionID string) error
}
)
@@ -37,7 +37,7 @@ const (
resourcesCheckAccess = "/resources/%s/checkAccess?operation=%s&session=%s"
)
func (u *Resources) CheckAccess(resourceID string, operation string, sessionID string) error {
func (u *Resources) CheckAccess(resourceID, operation, sessionID string) error {
resp, err := u.Client.Get(fmt.Sprintf(resourcesCheckAccess, resourceID, operation, sessionID))
if err != nil {
return errors.Wrap(err, "request failed")
@@ -69,7 +69,7 @@ func (u *Resources) Create(resourceID string, operations []string) error {
}
}
func (u *Resources) Grant(resourceID string, rolepath string, operations []string) error {
func (u *Resources) Grant(resourceID, rolepath string, operations []string) error {
body := make([]ResourcesRole, len(operations))
for index, operation := range operations {
body[index] = ResourcesRole{rolepath, operation}
+3 -3
View File
@@ -9,7 +9,7 @@ type (
EventQueue interface {
EventQueuePull(origin uint64) ([]*types.EventQueueItem, error)
EventQueuePush(eqi *types.EventQueueItem) error
EventQueueSync(origin uint64, ID uint64) error
EventQueueSync(origin, id uint64) error
}
)
@@ -29,7 +29,7 @@ func (r *repository) EventQueuePush(eqi *types.EventQueueItem) error {
return r.db().Quiet().Insert("event_queue", eqi)
}
func (r *repository) EventQueueSync(origin uint64, ID uint64) error {
func (r *repository) EventQueueSync(origin, id uint64) error {
type evqs struct {
Origin uint64 `db:"origin"`
LastEvent uint64 `db:"rel_last"`
@@ -38,7 +38,7 @@ func (r *repository) EventQueueSync(origin uint64, ID uint64) error {
// @todo do we even need this?
return r.db().Quiet().Replace("event_queue_synced", evqs{
Origin: origin,
LastEvent: ID,
LastEvent: id,
})
}
+1 -1
View File
@@ -107,7 +107,7 @@ func (ps *PubSub) Subscribe(onStart func() error, onMessage func(channel string,
}
}
func (ps *PubSub) Publish(channel string, payload string) error {
func (ps *PubSub) Publish(channel, payload string) error {
// main redis connection
conn, err := ps.dial()
if err != nil {
+3 -1
View File
@@ -30,10 +30,12 @@ func Init() error {
if err != nil {
return err
}
// @todo: profiling as an external service?
switch config.db.profiler {
case "stdout":
db.Profiler = &factory.Database.ProfilerStdout
// @todo: profiling as an external service?
default:
fmt.Println("No database query profiler selected")
}
// configure resputil options