mirror of
https://github.com/luzifer/vim.git
synced 2024-12-29 22:31:20 +00:00
18 lines
418 B
Bash
Executable file
18 lines
418 B
Bash
Executable file
#!/bin/bash
|
|
set -euxo pipefail
|
|
|
|
[ ${DEBUG:-0} -eq 1 ] && exec 2>/tmp/gofmtimport.dbg
|
|
|
|
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"
|
|
${cmdfmt} -s -w "$2"
|