The analyzer has detected a method or function call whose return value is not used. Calling certain methods does not make sense without using their return values.
Look at the example:
req, err := http.NewRequest(....)
....
req.WithContext(ctx)
In this code, the WithContext method is called from the req variable of the http.Request type. This method returns a copy of the request with a modified context. So, calling WithContext without saving the http.Request returned by the method makes no sense.
The fixed code:
req, err := http.NewRequest(....)
....
req = req.WithContext(ctx)
This diagnostic rule is classified as:
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: