diff --git a/.circleci/check-gofmt b/.circleci/check-gofmt
new file mode 100755
index 0000000000000000000000000000000000000000..b9c4731eae06ebaafafc9ee0fff3d4566144f903
--- /dev/null
+++ b/.circleci/check-gofmt
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+result="$(gofmt -e -s -l . 2>&1 | grep -v '^vendor/' )"
+if [ -n "$result" ]; then
+  echo "Go code is not formatted, run 'gofmt -e -s -w .'" >&2
+  echo "$result"
+  exit 1
+else
+  echo "Go code is formatted well"
+fi
diff --git a/.circleci/config.yml b/.circleci/config.yml
index c5af3d3ef3223d8b150a3fd22f8d0dd609d633f7..62904d8b5b54cf025454b1e9eb38452d68d9baad 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -18,3 +18,4 @@ jobs:
       - run: go test -v -cover -coverprofile=coverage.out ./...
       - run: goveralls -coverprofile=coverage.out -service=circle-ci -repotoken=$COVERALLS_TOKEN
       - run: .circleci/build-examples
+      - run: .circleci/check-gofmt