funktionio / funktion

a CLI tool for working with funktion
https://funktion.fabric8.io/
Apache License 2.0
297 stars 25 forks source link

Consider formatting code with `gofmt` #37

Open bbrowning opened 7 years ago

bbrowning commented 7 years ago

Many Golang project use gofmt to consistently format their Go code. And, it's not uncommon to setup your editor to automatically run gofmt when saving changes to a file. Perhaps we should consider doing so as well?

bbrowning commented 7 years ago

Here's an example of how gofmt would change the existing code - https://github.com/bbrowning/funktion/commit/076935a8bc7b09d0cbe528c4f0d6790c22407b8e

It's mainly consistent whitespace and import ordering changes.

jstrachan commented 7 years ago

Good idea! We should probably hack the Makefile to invoke it - maybe on the test target?

jimmidyson commented 7 years ago

Most projects set up CI validation for this.

maleck13 commented 7 years ago

We use the following for this in our makefile. Happy to make a PR

check-gofmt:
    diff <(gofmt -d -s .) <(printf "")

.PHONY: check-golint
check-golint:
    diff <(golint ./... | grep -v vendor/) <(printf "")
jstrachan commented 7 years ago

@maleck13 that'd be awesome if you could thanks!