exported func NewCollectBucketStatsTask returns unexported type *buckets.collectBucketStatsTask, which can be annoying to use
71}
72
73// NewCollectBucketStatsTask creates task to collect bucket stats.
74func NewCollectBucketStatsTask(minDegree int, regionIDs ...uint64) *collectBucketStatsTask {75 return &collectBucketStatsTask{
76 minDegree: minDegree,
77 regionIDs: regionIDs,
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")
}