exported func NewScanner returns unexported type *lidar.scanner, which can be annoying to use
11 "strconv"
12)
13
14func NewScanner(checkFactory db.CheckFactory, planFactory atc.PlanFactory, batchSize int) *scanner { 15 return &scanner{
16 checkFactory: checkFactory,
17 planFactory: planFactory,
Description
An exported function or method returning a value of an unexported type may be frustrating to use.
In Go, if the function or method starts with a lowercase letter, it is not exported outside the package.
Bad practice
type unexportedType string
func ExportedFunc() *unexportedType {
return &unexportedType("some string")
}
Recommended
type ExportedType string
func ExportedFunc() *ExportedType {
return &ExportedType("some string")
}