Golang代码规范检查记录
● ID rather than Id
● indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive),if里如果有return,else多余,else的代码块直接在if后面外部执行即可
● context-as-argument: context.Context should be the first parameter of a function
● increment-decrement: should replace rcv.reloadCount += 1 with rcv.reloadCount++
● composites: go.opentelemetry.io/collector/component.ExporterCreateSettings
composite literal uses unkeyed fields (govet)
● type assertion to the same type: processor.firstTC already has type consumer.Traces (gosimple)
○ require.NoError(t, processor.firstTC.(consumer.Traces).ConsumeTraces(context.Background(), td))
● nilness: tautological condition: non-nil != nil (govet)
● shadow: declaration of “exp” shadows declaration at line 171
● ineffectual assignment to err