mirror of
https://github.com/luzifer/vim.git
synced 2024-12-20 10:21:19 +00:00
Prefer gofumpt before gofmt
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
b9d7e8e351
commit
467a2b8cc2
1 changed files with 10 additions and 2 deletions
|
@ -3,8 +3,16 @@ set -euxo pipefail
|
|||
|
||||
[ ${DEBUG:-0} -eq 1 ] && exec 2>/tmp/gofmtimport.dbg
|
||||
|
||||
goimports \
|
||||
cmdimports=$(command -v gofumports || command -v goimports || true)
|
||||
cmdfmt=$(command -v gofumpt || command -v gofmt || true)
|
||||
|
||||
[[ -n $cmdimports ]] && [[ -n $cmdfmt ]] || {
|
||||
echo "No imports command or no fmt command found" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
${cmdimports} \
|
||||
-srcdir "$2" \
|
||||
-local "${GOIMPORT_LOCAL:-}" \
|
||||
-w "$2"
|
||||
gofmt -s -w "$2"
|
||||
${cmdfmt} -s -w "$2"
|
||||
|
|
Loading…
Reference in a new issue