Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: ignore comments don't work #27

@tamayika

Description

@tamayika

repro

  1. git clone https://github.com/gcpug/zagane.git
  2. cd zagane
  3. edit test code as follows.
diff --git a/passes/unstopiter/testdata/src/a/a.go b/passes/unstopiter/testdata/src/a/a.go
index 0ad4cf5..c78dd04 100644
--- a/passes/unstopiter/testdata/src/a/a.go
+++ b/passes/unstopiter/testdata/src/a/a.go
@@ -8,7 +8,8 @@ import (

 func f1(ctx context.Context, client *spanner.Client) {
        stmt := spanner.Statement{SQL: `SELECT 1`}
-       _, _ = client.Single().Query(ctx, stmt).Next() // want "iterator must be stopped"
+       //lint:ignore unstopiter reason
+       _, _ = client.Single().Query(ctx, stmt).Next()
        client.Single().Query(ctx, stmt).Stop()        // OK
        defer client.Single().Query(ctx, stmt).Stop()  // OK
 }
  1. go test .\passes\unstopiter\unstopiter_test.go

Expected: Test passes
Actual: Test fails

$ go test .\passes\unstopiter\unstopiter_test.go
--- FAIL: Test (2.40s)
    analysistest.go:251: a/a.go:12:30: unexpected diagnostic: iterator must be stopped
FAIL
FAIL    command-line-arguments  2.550s

This is maybe github.com/gostaticanalysis/comment bug or misusage.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions