-
Notifications
You must be signed in to change notification settings - Fork 285
Fix various golangci linter issues #977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,11 +17,6 @@ import ( | |||||
| "go.opencensus.io/trace" | ||||||
| ) | ||||||
|
|
||||||
| type cdevent struct { | ||||||
| topic string | ||||||
| event interface{} | ||||||
| } | ||||||
|
|
||||||
| var _ = (task.TaskService)(&service{}) | ||||||
|
|
||||||
| type service struct { | ||||||
|
|
@@ -460,7 +455,7 @@ func (s *service) DiagPid(ctx context.Context, req *shimdiag.PidRequest) (*shimd | |||||
| if s == nil { | ||||||
| return nil, nil | ||||||
| } | ||||||
| ctx, span := trace.StartSpan(ctx, "DiagPid") | ||||||
| ctx, span := trace.StartSpan(ctx, "DiagPid") //nolint:ineffassign,staticcheck | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. curious; what was the linter complaining about here?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It complained because the call to
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah! would something like this work for those as well?
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, @thaJeztah commented right before me :)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can't add new functions on the context struct type since it's defined in a different imported package that we don't own.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we keep the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not from what I've seen
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have a strong preference here. I would probably go with
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'm going to keep the |
||||||
| defer span.End() | ||||||
|
|
||||||
| span.AddAttributes(trace.StringAttribute("tid", s.tid)) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,12 +147,11 @@ func newHcsTask( | |
| } | ||
|
|
||
| opts := hcsoci.CreateOptions{ | ||
| ID: req.ID, | ||
| Owner: owner, | ||
| Spec: s, | ||
| HostingSystem: parent, | ||
| NetworkNamespace: netNS, | ||
| ScaleCPULimitsToSandbox: shimOpts.ScaleCpuLimitsToSandbox, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did we remove this assignment?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The linter was complaining because below we check if
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cry
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like it was noticed just before / after merge 🙈 #915 (comment)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought I force pushed to fix before checking in 😭 😭 😭. Well I've gotta give it to myself, I both fixed it and then broke it again. This deserves a medal
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💩 happens; you did that to test if the linters work, correct? 😂
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 100%, don't let anyone tell you otherwise 😉 |
||
| ID: req.ID, | ||
| Owner: owner, | ||
| Spec: s, | ||
| HostingSystem: parent, | ||
| NetworkNamespace: netNS, | ||
| } | ||
|
|
||
| if shimOpts != nil { | ||
|
|
@@ -204,7 +203,7 @@ func newHcsTask( | |
| go ht.waitInitExit(!isTemplate) | ||
|
|
||
| // Publish the created event | ||
| ht.events.publishEvent( | ||
| if err := ht.events.publishEvent( | ||
| ctx, | ||
| runtime.TaskCreateEventTopic, | ||
| &eventstypes.TaskCreate{ | ||
|
|
@@ -219,7 +218,9 @@ func newHcsTask( | |
| }, | ||
| Checkpoint: "", | ||
| Pid: uint32(ht.init.Pid()), | ||
| }) | ||
| }); err != nil { | ||
| return nil, err | ||
| } | ||
| return ht, nil | ||
| } | ||
|
|
||
|
|
@@ -312,7 +313,7 @@ func newClonedHcsTask( | |
| go ht.waitInitExit(true) | ||
|
|
||
| // Publish the created event | ||
| ht.events.publishEvent( | ||
| if err := ht.events.publishEvent( | ||
| ctx, | ||
| runtime.TaskCreateEventTopic, | ||
| &eventstypes.TaskCreate{ | ||
|
|
@@ -327,7 +328,9 @@ func newClonedHcsTask( | |
| }, | ||
| Checkpoint: "", | ||
| Pid: uint32(ht.init.Pid()), | ||
| }) | ||
| }); err != nil { | ||
| return nil, err | ||
| } | ||
| return ht, nil | ||
| } | ||
|
|
||
|
|
@@ -443,15 +446,13 @@ func (ht *hcsTask) CreateExec(ctx context.Context, req *task.ExecProcessRequest, | |
| ht.execs.Store(req.ExecID, he) | ||
|
|
||
| // Publish the created event | ||
| ht.events.publishEvent( | ||
| return ht.events.publishEvent( | ||
| ctx, | ||
| runtime.TaskExecAddedEventTopic, | ||
| &eventstypes.TaskExecAdded{ | ||
| ContainerID: ht.id, | ||
| ExecID: req.ExecID, | ||
| }) | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| func (ht *hcsTask) GetExec(eid string) (shimExec, error) { | ||
|
|
@@ -542,7 +543,7 @@ func (ht *hcsTask) DeleteExec(ctx context.Context, eid string) (int, uint32, tim | |
| } | ||
|
|
||
| // Publish the deleted event | ||
| ht.events.publishEvent( | ||
| if err := ht.events.publishEvent( | ||
| ctx, | ||
| runtime.TaskDeleteEventTopic, | ||
| &eventstypes.TaskDelete{ | ||
|
|
@@ -551,7 +552,9 @@ func (ht *hcsTask) DeleteExec(ctx context.Context, eid string) (int, uint32, tim | |
| Pid: status.Pid, | ||
| ExitStatus: status.ExitStatus, | ||
| ExitedAt: status.ExitedAt, | ||
| }) | ||
| }); err != nil { | ||
| return 0, 0, time.Time{}, err | ||
| } | ||
|
|
||
| return int(status.Pid), status.ExitStatus, status.ExitedAt, nil | ||
| } | ||
|
|
@@ -741,7 +744,8 @@ func (ht *hcsTask) closeHost(ctx context.Context) { | |
| } | ||
| // Send the `init` exec exit notification always. | ||
| exit := ht.init.Status() | ||
| ht.events.publishEvent( | ||
|
|
||
| if err := ht.events.publishEvent( | ||
| ctx, | ||
| runtime.TaskExitEventTopic, | ||
| &eventstypes.TaskExit{ | ||
|
|
@@ -750,7 +754,9 @@ func (ht *hcsTask) closeHost(ctx context.Context) { | |
| Pid: uint32(exit.Pid), | ||
| ExitStatus: exit.ExitStatus, | ||
| ExitedAt: exit.ExitedAt, | ||
| }) | ||
| }); err != nil { | ||
| log.G(ctx).WithError(err).Error("failed to publish TaskExitEventTopic") | ||
| } | ||
| close(ht.closed) | ||
| }) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.