go-errorlint
go-errorlint copied to clipboard
Conflicting edits
Using golangci-lint 2.1.6 with errorlint enabled and --fix:
WARN [runner] Changes related to "errorlint" are skipped for the file "/app/processmanager/processinfo.go": conflicting edits from errorlint and errorlint on /app/processmanager/processinfo.go
first edits:
--- base
+++ errorlint
@@ -628,7 +628,8 @@
// Since listing /proc and opening files in there later is inherently racy,
// we expect to lose the race sometimes and thus expect to hit os.IsNotExist.
pm.mappingStats.errProcNotExist.Add(1)
- } else if e, ok := err.(*os.PathError); ok && e.Err == syscall.ESRCH {
+ } else e := &os.PathError{}
+if errors.As(err, &e){
// If the process exits while reading its /proc/$PID/maps, the kernel will
// return ESRCH. Handle it as if the process did not exist.
pm.mappingStats.errProcESRCH.Add(1)
second edits:
--- base
+++ errorlint
@@ -628,7 +628,7 @@
// Since listing /proc and opening files in there later is inherently racy,
// we expect to lose the race sometimes and thus expect to hit os.IsNotExist.
pm.mappingStats.errProcNotExist.Add(1)
- } else if e, ok := err.(*os.PathError); ok && e.Err == syscall.ESRCH {
+ } else if e, ok := err.(*os.PathError); ok && errors.Is(e.Err, syscall.ESRCH) {
// If the process exits while reading its /proc/$PID/maps, the kernel will
// return ESRCH. Handle it as if the process did not exist.
pm.mappingStats.errProcESRCH.Add(1)
Tagging @kakkoyun as they are the author of the automatic fixes.
@kakkoyun are you available to look into this?
Tagging @kakkoyun as they are the author of the automatic fixes.
@kakkoyun are you available to look into this?
Thanks for the ping! I’ll do my best to take a look this week. If someone else gets to it first, feel free to jump in!
I'm sorry, I still haven't had free cycles to check this out. But it is on my list.
Finally found some free-cycles and introduce a fix #104