Commit 5fd923bd authored by Jacob Vosmaer's avatar Jacob Vosmaer

Check go formatting in CI

parent e3dc9c76
......@@ -52,3 +52,4 @@ go:
- which go
- bin/compile
- support/go-test
- support/go-format check
#!/usr/bin/env ruby
def main(check)
go_files = Dir['go/**/*.go'].reject { |p| p.start_with?('go/vendor/') }
cmd = %w[gofmt -s -l]
cmd << '-w' unless check
cmd += go_files
output = IO.popen(cmd, 'r') { |io| io.read }
$stdout.write(output)
abort 'gofmt failed' unless $?.success?
if check && output.lines.any? { |l| l != "\n" }
abort "\nPlease run #{$0} to fix formatting"
end
end
main(ARGV.first == 'check')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment