citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit 3677cf8f6da0228f25c6dbfee1ede7fdd0508ee7
parent c63c272c080ba3f330b7d6aa65e73abca8561774
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 29 Dec 2020 10:35:09 -0800

vim: gofmt

Diffstat:
Abin/gofmt-safe | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/bin/gofmt-safe b/bin/gofmt-safe @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +orig=$(mktemp) +fmt=$(mktemp) + +cat > "$orig" + +<"$orig" gofmt "$@" > "$fmt" 2>/dev/null + +if [ $? -eq 0 ]; then + cat "$fmt" +else + cat "$orig" +fi + +rm -f "$orig" "$fmt"