Skip to content

Commit

Permalink
Fix git hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
samshadwell committed Nov 27, 2023
1 parent d622b29 commit dc31ee3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
5 changes: 4 additions & 1 deletion cmd/split-ynab/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ func main() {
fmt.Printf("failed to initialize logger: %v", err)
os.Exit(1)
}
defer logger.Sync()
defer func() {
// If this fails there's not much to do about it. This is mostly here to appease the linter.
_ = logger.Sync()
}()

f, err := os.Open(configFile)
if err != nil {
Expand Down
8 changes: 8 additions & 0 deletions githooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Install by running:

```
git config core.hooksPath contrib/githooks
```

From root directory.

5 changes: 3 additions & 2 deletions githooks/pre-commit.sh → githooks/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
#!/bin/bash

set -e

golangci-lint run ./...
go mod tidy && git add go.mod go.sum

5 changes: 5 additions & 0 deletions githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

go test ./...
4 changes: 0 additions & 4 deletions githooks/pre-push.sh

This file was deleted.

0 comments on commit dc31ee3

Please sign in to comment.