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
A few days ago, I started using the Go linter (with Go 1.21). When running it on my Baloo tests, there were many warnings about ignoring the error returned by the Done() method.
Even when looking at the first example below:
package simple
import (
"testing""gopkg.in/h2non/baloo.v3"
)
// test stores the HTTP testing client preconfiguredvartest=baloo.New("http://httpbin.org")
funcTestBalooSimple(t*testing.T) {
test.Get("/get").
SetHeader("Foo", "Bar").
Expect(t).
Status(200).
Header("Server", "apache").
Type("json").
JSON(map[string]string{"bar": "foo"}).
Done() // Warning: Error return value of `(gopkg.in/h2non/baloo.v3.Expect).Done` is not checked (errcheck)
}
Is there a good way to use Baloo without having the warning? One possibility would be to write this:
But then the error is reported twice and it makes writing tests less friendly/readable.
It seems that the best way to handle this would be to remove the returned error from the Done() method signature, or to provide another method that does not return the error.
Any thought? @h2non: I am willing to write a pull request if you agree with one of my propositions or if you have another one.
The text was updated successfully, but these errors were encountered:
Hi!
A few days ago, I started using the Go linter (with Go 1.21). When running it on my Baloo tests, there were many warnings about ignoring the error returned by the
Done()
method.Even when looking at the first example below:
Is there a good way to use Baloo without having the warning? One possibility would be to write this:
But then the error is reported twice and it makes writing tests less friendly/readable.
It seems that the best way to handle this would be to remove the returned error from the
Done()
method signature, or to provide another method that does not return the error.Any thought? @h2non: I am willing to write a pull request if you agree with one of my propositions or if you have another one.
The text was updated successfully, but these errors were encountered: