+
Skip to content

unclosetx: false positive detection with errgroup #32

Open
@takatoshiono

Description

@takatoshiono

When I use errgroup, zagane reports transaction must be closed. I think that it's false positive detection.

sample code:

func f5(ctx context.Context, client *spanner.Client) error {
	tx := client.ReadOnlyTransaction() // OK
	defer tx.Close()

	var eg errgroup.Group

	eg.Go(func() error {
		_ = tx // use tx
		return nil
	})

	if err := eg.Wait(); err != nil {
		return err
	}
	return nil
}

Metadata

Metadata

Assignees

No one assigned

    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

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载