Field alignment is a standard simple trick recommended in Go-based apps for better memory usage and fast processing.
I found that the structs defined in the package aren't following the field alignment. Here is the output of the lint
$go vet -vettool=$(which fieldalignment) ./...
# github.com/startreedata/pinot-client-go/pinot
pinot/config.go:6:19: struct with 56 pointer bytes could be 32
pinot/config.go:25:22: struct with 32 pointer bytes could be 24
pinot/config.go:33:23: struct with 32 pointer bytes could be 16
pinot/controllerBasedBrokerSelector.go:28:30: struct with 96 pointer bytes could be 56
pinot/controllerResponse.go:8:16: struct with 32 pointer bytes could be 24
pinot/dynamicBrokerSelector.go:21:28: struct with 96 pointer bytes could be 64
pinot/dynamicBrokerSelector.go:30:19: struct with 40 pointer bytes could be 32
pinot/response.go:6:21: struct with 72 pointer bytes could be 56
pinot/response.go:54:16: struct with 16 pointer bytes could be 8
pinot/controllerBasedBrokerSelector_test.go:16:28: struct with 24 pointer bytes could be 16
This issue tracks to change the defined structs with aligned fields and add support in the lint for future checks.
Field alignment is a standard simple trick recommended in Go-based apps for better memory usage and fast processing. I found that the structs defined in the package aren't following the field alignment. Here is the output of the lint
This issue tracks to change the defined structs with aligned fields and add support in the lint for future checks.
I will work on this issue. Thanks
cc @xiangfu0