Skip to content

Commit

Permalink
sql/sqlx: fix spacing on the new lines (#3359)
Browse files Browse the repository at this point in the history
currently, `.NL().P("FOO")` write ` FOO` in the new line, this commit remove the space before `FOO`
  • Loading branch information
giautm authored Feb 2, 2025
1 parent 5dc92c5 commit 6e3b402
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sql/internal/sqlx/sqlx.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (b *Builder) P(phrases ...string) *Builder {
if p == "" {
continue
}
if b.Len() > 0 && b.lastByte() != ' ' && b.lastByte() != '(' {
if b.Len() > 0 && !slices.Contains([]byte{' ', '(', '\n'}, b.lastByte()) {
b.WriteByte(' ')
}
b.WriteString(p)
Expand Down

0 comments on commit 6e3b402

Please sign in to comment.