You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 10, 2025. It is now read-only.
iferr==syscall.ENOENT { // want "comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error"
13
+
// This block comment should be preserved
14
+
println("File not found")
15
+
}
16
+
}
17
+
18
+
// Test else-if comment preservation (main PR issue)
19
+
funcElseIfComments() {
20
+
varerrerror
21
+
22
+
iferr!=nil {
23
+
println("error occurred")
24
+
} elseife, ok:=err.(*os.PathError); ok&&e.Err==syscall.ESRCH { // want "type assertion and error comparison will fail on wrapped errors. Use errors.As and errors.Is to check for specific errors"
25
+
// If the process exits while reading its /proc/$PID/maps, the kernel will
26
+
// return ESRCH. Handle it as if the process did not exist.
27
+
println("Process not found")
28
+
}
29
+
}
30
+
31
+
// Test block comments
32
+
funcBlockComments() {
33
+
varerrerror
34
+
35
+
/* Pre-condition block comment */
36
+
ife, ok:=err.(*os.PathError); ok { // want "type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors"
// Test missing errors import with simple comparison
10
+
func MissingImportSimple() {
11
+
var err error
12
+
var n int
13
+
14
+
if n == 0 || (err != nil && !errors.Is(err, io.EOF)) { // want "comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error"
15
+
return
16
+
}
17
+
}
18
+
19
+
// Test missing errors import with type assertion
20
+
func MissingImportTypeAssertion() {
21
+
var err error
22
+
23
+
e := &os.PathError{}
24
+
if errors.As(err, &e) { // want "type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors"
0 commit comments