mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 11:55:51 +00:00 
			
		
		
		
	~I will add pre-commit hook later if I find a good one~ Found a nice repo, but it is no longer maintained: https://github.com/dnephin/pre-commit-golang So, I implemented the check as a local hook.
		
			
				
	
	
		
			15 lines
		
	
	
		
			294 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			294 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
#
 | 
						|
# Capture and print stdout, since gofmt doesn't use proper exit codes
 | 
						|
#
 | 
						|
set -e -o pipefail
 | 
						|
 | 
						|
if ! command -v gofmt &> /dev/null ; then
 | 
						|
    echo "gofmt not installed or available in the PATH" >&2
 | 
						|
    exit 1
 | 
						|
fi
 | 
						|
 | 
						|
output="$(gofmt -l -w "$@")"
 | 
						|
echo "$output"
 | 
						|
[[ -z "$output" ]]
 |