Open y7ls8i opened 4 months ago
the same case
if err = n.db.Unscoped().Model(&models.User{}).Where("id = ?", id).First(&item).Error; err == nil {
}
but below is worked:
err = n.db.Unscoped().Model(&models.NotebookEnv{}).Where("id = ?", id).First(&item).Error
if err == nil {
}
The IfStmt.Init
node isn't considered for shortening in the block: https://github.com/segmentio/golines/blob/13c3f0d546260ae1a722ad39e761392f7c52b653/shortener.go#L460, but even if it was the shortening Decoration
is on the IfStmt
node and not the Init
node so even if we did s.formatStmt(st.Init)
in that first block linked the hasAnnotation
call in formatStmt
will return false
" https://github.com/segmentio/golines/blob/13c3f0d546260ae1a722ad39e761392f7c52b653/shortener.go#L424
I suspect a fix would require adding something like the force
parameter like formatExpr
has: https://github.com/segmentio/golines/blob/13c3f0d546260ae1a722ad39e761392f7c52b653/shortener.go#L485
should have been broken down into:
but it doesn't.