-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add pre-commit hook & convenience script to add it. fix some vet errors. #2
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exit on error. | ||
set -e | ||
|
||
echo "Running go vet..." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need with -x |
||
go vet ./... | ||
|
||
echo "Running tests..." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
go test ./... | ||
|
||
echo "Running gofmt..." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
find . -name "*.go" | xargs gofmt -w | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indeed there is. that was easy. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,22 +104,22 @@ func TestSlots(t *testing.T) { | |
// Increment a slot and verify. | ||
f.incrementSlot(0, 1) | ||
if f.getSlot(0) != 1 { | ||
t.Error("slot value %d != 1", f.getSlot(0)) | ||
t.Errorf("slot value %d != 1", f.getSlot(0)) | ||
} | ||
// Increment past max count. | ||
f.incrementSlot(0, int32(f.MaxCount)) | ||
if f.getSlot(0) != f.MaxCount { | ||
t.Error("slot value should be max %d != %d", f.getSlot(0), f.MaxCount) | ||
t.Errorf("slot value should be max %d != %d", f.getSlot(0), f.MaxCount) | ||
} | ||
// Decrement once. | ||
f.incrementSlot(0, -1) | ||
if f.getSlot(0) != f.MaxCount-1 { | ||
t.Error("slot value should be max %d != %d", f.getSlot(0), f.MaxCount-1) | ||
t.Errorf("slot value should be max %d != %d", f.getSlot(0), f.MaxCount-1) | ||
} | ||
// Decrement past 0. | ||
f.incrementSlot(0, -int32(f.MaxCount)) | ||
if f.getSlot(0) != 0 { | ||
t.Error("slot value should be max %d != 0", f.getSlot(0)) | ||
t.Errorf("slot value should be max %d != 0", f.getSlot(0)) | ||
} | ||
} | ||
|
||
|
@@ -181,7 +181,7 @@ func TestFalsePositives(t *testing.T) { | |
empFP := float64(countFP) / float64(1000) | ||
diff := math.Abs(probFP - empFP) | ||
if diff/probFP > 0.50 { | ||
t.Errorf("measured P(FP) > 50% different from expected %f vs. %f", diff, empFP) | ||
t.Errorf("measured P(FP) > 50%% different from expected %f vs. %f", diff, empFP) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. double percent? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in order to print an actual There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh right duh. didn't see you were trying to print a %-age value |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# Create symlinks to all git hooks in your own .git dir. | ||
echo "### Creating symlinks to our git hooks..." | ||
for f in $(ls -d githooks/*) | ||
do ln -s ../../$f .git/hooks | ||
done && ls -al .git/hooks | grep githooks | ||
echo "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit set -x as well for diagnostic output