go-errorlint icon indicating copy to clipboard operation
go-errorlint copied to clipboard

Conflicting edits

Open rockdaboot opened this issue 6 months ago • 4 comments

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) 

rockdaboot avatar Jun 08 '25 18:06 rockdaboot

Tagging @kakkoyun as they are the author of the automatic fixes.

@kakkoyun are you available to look into this?

polyfloyd avatar Jun 09 '25 15:06 polyfloyd

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!

kakkoyun avatar Jun 10 '25 08:06 kakkoyun

I'm sorry, I still haven't had free cycles to check this out. But it is on my list.

kakkoyun avatar Jun 25 '25 09:06 kakkoyun

Finally found some free-cycles and introduce a fix #104

kakkoyun avatar Aug 06 '25 18:08 kakkoyun