zagane icon indicating copy to clipboard operation
zagane copied to clipboard

unclosetx: not detect about nested struct having Spanner's client

Open iwata opened this issue 4 years ago • 0 comments

unclosetx cannot detect looks like this sample code.

func (h *Handler) fetchUser(ctx context.Context, userID string) (*database.User, error) {
	txn := h.repository.Client.ReadOnlyTransaction() // h.repository.Client is a Spanner client.
	
	user, err := database.FindUser(ctx, txn, userID)
	if err != nil {
		return nil, err
	}
	return user, nil
}

iwata avatar Mar 31 '21 13:03 iwata