diff --git a/service/debug_test.go b/service/debug_test.go index 52fbe0c7c..7e2ee495a 100644 --- a/service/debug_test.go +++ b/service/debug_test.go @@ -9,6 +9,8 @@ import ( ) func TestDebug(t *testing.T) { + t.Parallel() + // Create test instance with at least one worker. i := &Instance{} n, err := notifications.New(i) diff --git a/service/mgr/group.go b/service/mgr/group.go index 035bcf05e..0019c28c0 100644 --- a/service/mgr/group.go +++ b/service/mgr/group.go @@ -30,6 +30,7 @@ const ( groupStateInvalid ) +//nolint:goconst func groupStateToString(state int32) string { switch state { case groupStateOff: diff --git a/service/mgr/worker_info.go b/service/mgr/worker_info.go index 9f281da23..7f0441895 100644 --- a/service/mgr/worker_info.go +++ b/service/mgr/worker_info.go @@ -176,7 +176,8 @@ func (m *Manager) WorkerInfo(s *stack.Snapshot) (*WorkerInfo, error) { "waiting", "dead", "enqueue", "copystack": wi.Running++ case "chan send", "chan receive", "select", "IO wait", - "panicwait", "semacquire", "semarelease", "sleep": + "panicwait", "semacquire", "semarelease", "sleep", + "sync.Mutex.Lock": wi.Waiting++ case "": if w.workerMgr != nil { @@ -213,10 +214,10 @@ func (wi *WorkerInfo) Format() string { // Build table. tabWriter := tabwriter.NewWriter(buf, 4, 4, 3, ' ', 0) - fmt.Fprintf(tabWriter, "#\tState\tModule\tName\tWorker Func\tCurrent Line\tExtra Info\n") + _, _ = fmt.Fprintf(tabWriter, "#\tState\tModule\tName\tWorker Func\tCurrent Line\tExtra Info\n") for _, wd := range wi.Workers { - fmt.Fprintf(tabWriter, + _, _ = fmt.Fprintf(tabWriter, "%d\t%s\t%s\t%s\t%s\t%s\t%s\n", wd.Count, wd.State, @@ -365,13 +366,14 @@ func workerDetailsAreEqual(a, b *WorkerInfoDetail) bool { } } +//nolint:goconst func goroutineStateOrder(state string) int { switch state { case "runnable", "running", "syscall": return 0 // Active. case "idle", "waiting", "dead", "enqueue", "copystack": return 1 // Active-ish. - case "semacquire", "semarelease", "sleep", "panicwait": + case "semacquire", "semarelease", "sleep", "panicwait", "sync.Mutex.Lock": return 2 // Bad (practice) blocking. case "chan send", "chan receive", "select": return 3 // Potentially bad (practice), but normal blocking. diff --git a/service/mgr/workermgr.go b/service/mgr/workermgr.go index 138ab1670..7abaddb32 100644 --- a/service/mgr/workermgr.go +++ b/service/mgr/workermgr.go @@ -196,6 +196,7 @@ manage: workerMgr: s, logger: s.ctx.logger, } + //nolint:fatcontext // Every run gets a new context. wCtx.ctx, wCtx.cancelCtx = context.WithCancel(s.ctx.ctx) panicInfo, err := s.mgr.runWorker(wCtx, s.fn)