k1LoW / tbls

tbls is a CI-Friendly tool for document a database, written in Go.
MIT License
3.32k stars 163 forks source link

Address lint errors #595

Closed mjpieters closed 2 weeks ago

mjpieters commented 2 weeks ago

I really like being able to rely on make lint being clean, seeing errors there, even if not in my own PR changes, makes me itch. 😅

Specifically, these lint issues have been addressed:

golangci-lint run ./...
drivers/mysql/mysql.go:501:49: ineffectual assignment to err (ineffassign)
                strColumns, strParentTable, strParentColumns, err := parseFK(r.Def)
                                                              ^
drivers/mongodb/mongodb.go:98:27: SA1019: result.Map is deprecated: Converting directly from a D to an M will not be supported in Go Driver 2.0. Instead, users should marshal the D to BSON using bson.Marshal and unmarshal it to M using bson.Unmarshal. (staticcheck)
                for key, value := range result.Map() {
                                        ^
drivers/sqlite/sqlite.go:368:49: ineffectual assignment to err (ineffassign)
                strColumns, strParentTable, strParentColumns, err := parseFK(r.Def)
                                                              ^
config/config.go:553:6: func `excludeTableFromSchema` is unused (unused)
func excludeTableFromSchema(name string, s *schema.Schema) error {
     ^
config/config.go:908:6: func `matchLabels` is unused (unused)
func matchLabels(il []string, l schema.Labels) bool {
     ^
mjpieters commented 2 weeks ago

I suspect that these lint issues have been missed for some time because you set the golanglint action to use the github-pr-check reporter. These end up as error annotations on the workflow summary page (see my other PR workflow summary), and the lint check itself doesn't show an error.

I recommend you change the configuration for that action to make these more visible:

k1LoW commented 2 weeks ago

@mjpieters Thank you!! I am very pleased with these improvements.