migrations: SQL formatting#1782
Conversation
| return nil | ||
| } | ||
|
|
||
| //go:generate find . -name *.sql -exec go run github.com/wasilibs/go-sql-formatter/v15/cmd/sql-formatter@latest --language postgresql --fix {} ; |
There was a problem hiding this comment.
This is the only "real" change, everything else is whitespace changes as a result of running go generate.
7172a7e to
a3c8df5
Compare
dcaravel
left a comment
There was a problem hiding this comment.
LGTM - can't say I agree with all the formatting decisions made by the lib, but that's a me problem ;)
| return nil | ||
| } | ||
|
|
||
| //go:generate find . -name *.sql -exec go run github.com/wasilibs/go-sql-formatter/v15/cmd/sql-formatter@latest --language postgresql --fix {} ; |
There was a problem hiding this comment.
For consideration - is it worth referencing a specific tag vs. latest here? Thinking of risk if repo is compromised, a tag + sumdb may help detect.
There was a problem hiding this comment.
So, this tool recommends against using go tool for dependency tree reasons.
I'd be wary of pinning a tag because then there's no good way to keep it updated.
Considering that its use is completely offline (we're checking in and reviewing the output) and any exploit would need to be in the wasm runtime or defeat the wasm sandbox, I think it's very low risk to just use latest.
There was a problem hiding this comment.
and any exploit would need to be in the wasm runtime or defeat the wasm sandbox, I think it's very low risk to just use latest.
Fair enough - counter-point: If that repo were compromised the attacker would likely remove the Wasm sandbox entirely and add malicious code, which would run directly on our machines during go generate.
This change adds a `generate` directive that runs an SQL formatter via `go run`. It also runs the formatter over the existing SQL. See-also: https://issues.redhat.com/browse/CLAIRDEV-85 Change-Id: I7ae14f596154b6f9bec66800c388bfe5ce732ca4 Signed-off-by: Hank Donnay <hdonnay@redhat.com>
a3c8df5 to
f00684c
Compare
Honestly me neither, but I think consistency wins over my formatting peccadilloes. It's like the go proverb:
|
|
/fast-forward |
This change adds a
generatedirective that runs an SQL formatter viago run. It also runs the formatter over the existing SQL.