How to exclude a single inspect?

已回答

I get an alert for a non-handled error in 

defer resp.Body.Close()

Is it possible to exclude that single command (Body.Close() for HTTP calls) so that it does not show as an alert?

0

Hello Michael,

Yes, it's possible, and here are the steps.

  • Navigate to a warning and press Alt(Option)+Enter.
  • Select Do not report this method/function anymore.

Pay attention that GoLand excludes all Close() methods with the ReadCloser receiver. You can enable an inspection back in the settings: Preferences / Settings | Editor | Inspections | Probable bugs | Unhandled error and exclude a method from the list.

I hope it helps.

0

请先登录再写评论。