Go language warnings and errors

后端 未结 4 1045
刺人心
刺人心 2021-02-19 18:08

It seems that GO language does not have warnings in it. I\'ve observed few instances. 1. \"declared and not used\"(if variable is declared and not used anywhere it gives an e

4条回答
  •  爱一瞬间的悲伤
    2021-02-19 19:06

    One solution for unused imports is to use goimports, which is a fork of gofmt. It automatically adds missing imports and removes unused ones (in addition to formatting your code).

    http://godoc.org/code.google.com/p/go.tools/cmd/goimports

    I've configured my editor to automatically run goimports whenever I save my code. I can't imagine writing go code without it now.

提交回复
热议问题