Skip to content

Commit

Permalink
fix go vet (#240)
Browse files Browse the repository at this point in the history
```console
$ go vet ./...
# github.com/tinkerbell/tink/db
db/workflow.go:206:36: call of append copies lock value: github.com/tinkerbell/tink/protos/workflow.WorkflowAction contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
db/workflow.go:679:12: call of fn copies lock value: github.com/tinkerbell/tink/protos/workflow.WorkflowActionStatus contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
# github.com/tinkerbell/tink/grpc-server
grpc-server/workflow.go:244:52: func passes lock by value: github.com/tinkerbell/tink/protos/workflow.WorkflowActionStatus contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex
```
  • Loading branch information
mergify[bot] authored Aug 6, 2020
2 parents 8065503 + 0de3164 commit 898c352
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions db/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func insertActionList(ctx context.Context, db *sql.DB, yamlData string, id uuid.
if err != nil {
return errors.Wrap(err, "Invalid Template")
}
var actionList []pb.WorkflowAction
var actionList []*pb.WorkflowAction
var uniqueWorkerID uuid.UUID
for _, task := range wfymldata.Tasks {
taskEnvs := map[string]string{}
Expand Down Expand Up @@ -203,7 +203,7 @@ func insertActionList(ctx context.Context, db *sql.DB, yamlData string, id uuid.
Environment: envs,
Volumes: ac.Volumes,
}
actionList = append(actionList, action)
actionList = append(actionList, &action)
}
}
totalActions := int64(len(actionList))
Expand Down Expand Up @@ -637,7 +637,7 @@ func InsertIntoWorkflowEventTable(ctx context.Context, db *sql.DB, wfEvent *pb.W
}

// ShowWorkflowEvents returns all workflows
func ShowWorkflowEvents(db *sql.DB, wfID string, fn func(wfs pb.WorkflowActionStatus) error) error {
func ShowWorkflowEvents(db *sql.DB, wfID string, fn func(wfs *pb.WorkflowActionStatus) error) error {
rows, err := db.Query(`
SELECT worker_id, task_name, action_name, execution_time, message, status, created_at
FROM workflow_event
Expand Down Expand Up @@ -667,7 +667,7 @@ func ShowWorkflowEvents(db *sql.DB, wfID string, fn func(wfs pb.WorkflowActionSt
return err
}
createdAt, _ := ptypes.TimestampProto(evTime)
wfs := pb.WorkflowActionStatus{
wfs := &pb.WorkflowActionStatus{
WorkerId: id,
TaskName: tName,
ActionName: aName,
Expand Down
2 changes: 1 addition & 1 deletion grpc-server/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func (s *server) ShowWorkflowEvents(req *workflow.GetRequest, stream workflow.Wo

timer := prometheus.NewTimer(metrics.CacheDuration.With(labels))
defer timer.ObserveDuration()
err := db.ShowWorkflowEvents(s.db, req.Id, func(w workflowpb.WorkflowActionStatus) error {
err := db.ShowWorkflowEvents(s.db, req.Id, func(w *workflowpb.WorkflowActionStatus) error {
wfs := &workflow.WorkflowActionStatus{
WorkerId: w.WorkerId,
TaskName: w.TaskName,
Expand Down

0 comments on commit 898c352

Please sign in to comment.