From 57e81fb6fb5d7ae1bee610c6b7d5dd1fe676e340 Mon Sep 17 00:00:00 2001
From: Daniel <dhaavi@users.noreply.github.com>
Date: Wed, 28 Aug 2024 11:55:40 +0200
Subject: [PATCH] [service] Make linter happy

---
 service/debug_test.go      |  2 ++
 service/mgr/group.go       |  1 +
 service/mgr/worker_info.go | 10 ++++++----
 service/mgr/workermgr.go   |  1 +
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/service/debug_test.go b/service/debug_test.go
index 52fbe0c7..7e2ee495 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 035bcf05..0019c28c 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 9f281da2..7f044189 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 138ab167..7abaddb3 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)