From b89d0ba175ca807f82488e0f8cf33ef0a68d2d4d Mon Sep 17 00:00:00 2001 From: Jonas Franz Date: Tue, 4 Jun 2019 11:00:58 +0200 Subject: [PATCH] Add fmt check Signed-off-by: Jonas Franz --- .drone.yml | 3 +- .gitignore | 84 +----------------------------------------------------- Makefile | 14 +++++++++ 3 files changed, 17 insertions(+), 84 deletions(-) diff --git a/.drone.yml b/.drone.yml index 5f104d0..80a6960 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,4 +6,5 @@ steps: image: golang:1.12 commands: - make lint - - make golangci-lint \ No newline at end of file + - make golangci-lint + - make fmt-check \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9ab2ad6..3b7e41d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,88 +20,6 @@ /vendor/ /Godeps/ -### Intellij ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/modules.xml -# .idea/*.iml -# .idea/modules - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -# JetBrains templates -**___jb_tmp___ - -### Intellij Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -.idea/sonarlint - -# End of https://www.gitignore.io/api/go,intellij +./idea config.yml diff --git a/Makefile b/Makefile index 949c567..4e9a9dd 100644 --- a/Makefile +++ b/Makefile @@ -11,3 +11,17 @@ lint: go get -u golang.org/x/lint/golint; \ fi golint ./... + +.PHONY: fmt-check +fmt-check: + # get all go files and run go fmt on them + @diff=$$(go fmt ./...); \ + if [ -n "$$diff" ]; then \ + echo "Please run 'make fmt' and commit the result:"; \ + echo "$${diff}"; \ + exit 1; \ + fi; + +.PHONY: fmt +fmt: + go fmt ./... \ No newline at end of file