Browse Source

Use .gitattributes to filter go sources through goimports

Cheer Xiao 10 years ago
parent
commit
615cbc2d0b
2 changed files with 22 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 21 0
      README.md

+ 1 - 0
.gitattributes

@@ -0,0 +1 @@
+*.go filter=goimports

+ 21 - 0
README.md

@@ -42,6 +42,27 @@ go get -u github.com/xiaq/elvish
 Remember to put the two `export`s above into your `bashrc` or `zshrc` (or
 whatever).
 
+## Notes for Contributors
+
+The `.gitattributes` in this repo dictates that go sources be filtered through
+the `goimports` filter before checking in. If you would like to contribute,
+you are advised to set up the filter:
+
+1. Install `goimports`:
+
+    ```
+    go get code.google.com/p/go.tools/cmd/goimports
+    ```
+
+2. Put this in `~/.gitconfig`:
+
+    ```
+    [filter "goimports"]
+        clean = goimports -tabwidth=4
+        smudge = cat
+        required
+    ```
+
 ## Name
 
 In rogue-likes, items made by the elves have a reputation of high quality.