Skip to content

Commit

Permalink
Fix golangci-lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeckman314 committed Sep 25, 2024
1 parent 1d4485b commit 52afc6f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion database/boltdb/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (taskBolt *BoltDB) GetNode(ctx context.Context, req *scheduler.GetNodeReque
})

if err == errNotFound {
return nil, status.Errorf(codes.NotFound, "foo")
return nil, status.Errorf(codes.NotFound, "%v: nodeID: %s", err.Error(), req.Id)
}

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion database/elastic/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (es *Elastic) GetNode(ctx context.Context, req *scheduler.GetNodeRequest) (
Do(ctx)

if elastic.IsNotFound(err) {
return nil, status.Errorf(codes.NotFound, "foo")
return nil, status.Errorf(codes.NotFound, "%v: nodeID: %s", err.Error(), req.Id)
}
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions database/mongodb/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (db *MongoDB) GetNode(ctx context.Context, req *scheduler.GetNodeRequest) (
var node scheduler.Node
err := db.nodes(db.client).FindOne(context.TODO(), bson.M{"id": req.Id}).Decode(&node)
if err == mongo.ErrNoDocuments {
return nil, status.Errorf(codes.NotFound, "foo")
return nil, status.Errorf(codes.NotFound, "%v: nodeID: %s", err, req.Id)
}

return &node, nil
Expand All @@ -78,7 +78,7 @@ func (db *MongoDB) DeleteNode(ctx context.Context, req *scheduler.Node) (*schedu
_, err := db.nodes(db.client).DeleteOne(context.TODO(), bson.M{"id": req.Id})
fmt.Println("DeleteNode", req.Id, err)
if err == mongo.ErrNoDocuments {
return nil, status.Errorf(codes.NotFound, "foo")
return nil, status.Errorf(codes.NotFound, "%v: nodeID: %s", err, req.Id)
}
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions server/tes.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type TaskService struct {
func (ts *TaskService) CreateTask(ctx context.Context, task *tes.Task) (*tes.CreateTaskResponse, error) {

if err := tes.InitTask(task, true); err != nil {
return nil, status.Errorf(codes.InvalidArgument, "foo")
return nil, status.Errorf(codes.InvalidArgument, "%v", err.Error())
}

err := ts.Compute.CheckBackendParameterSupport(task)
Expand Down Expand Up @@ -64,7 +64,7 @@ func (ts *TaskService) CreateTask(ctx context.Context, task *tes.Task) (*tes.Cre
func (ts *TaskService) GetTask(ctx context.Context, req *tes.GetTaskRequest) (*tes.Task, error) {
task, err := ts.Read.GetTask(ctx, req)
if err == tes.ErrNotFound {
err = status.Errorf(codes.NotFound, "foo")
err = status.Errorf(codes.NotFound, "%v: taskID: %s", err.Error(), req.Id)
}
return task, err
}
Expand All @@ -85,7 +85,7 @@ func (ts *TaskService) CancelTask(ctx context.Context, req *tes.CancelTaskReques
// updated database and other event streams
err = ts.Event.WriteEvent(ctx, events.NewState(req.Id, tes.Canceled))
if err == tes.ErrNotFound {
err = status.Errorf(codes.NotFound, "foo")
err = status.Errorf(codes.NotFound, "%v: taskID: %s", err.Error(), req.Id)
}
return &tes.CancelTaskResponse{}, err
}
Expand Down

0 comments on commit 52afc6f

Please sign in to comment.