Skip to content

Commit 9e0af96

Browse files
Merge pull request #14 from RedisBloom/gofmt.and.release.drafter
Added gofmt automation/check. Added release drafter github action.
2 parents ce792d3 + f7e0988 commit 9e0af96

File tree

6 files changed

+76
-12
lines changed

6 files changed

+76
-12
lines changed

.circleci/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ jobs:
1414
working_directory: /go/src/github.com/RedisBloom/redisbloom-go
1515
steps:
1616
- checkout
17-
- run: go get -v -t -d ./...
18-
19-
#run tests with coverage
17+
- run: make checkfmt
2018
- run: make get
2119
- run: make coverage
2220
- run: bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}

.github/release-drafter-config.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name-template: 'Version $NEXT_PATCH_VERSION - Summary Here🌈'
2+
tag-template: 'v$NEXT_PATCH_VERSION'
3+
categories:
4+
- title: '🚀Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: 'Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰Maintenance'
14+
label: 'chore'
15+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
16+
exclude-labels:
17+
- 'skip-changelog'
18+
template: |
19+
## Changes
20+
21+
$CHANGES
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
# branches to consider in the event; optional, defaults to all
6+
branches:
7+
- master
8+
9+
jobs:
10+
update_release_draft:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Drafts your next Release notes as Pull Requests are merged into "master"
14+
- uses: release-drafter/release-drafter@v5
15+
with:
16+
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
17+
config-name: release-drafter-config.yml
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.golangci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# options for analysis running
2+
run:
3+
# include test files or not, default is true
4+
tests: false
5+
6+
linters-settings:
7+
golint:
8+
# minimal confidence for issues, default is 0.8
9+
min-confidence: 0.8
10+
11+
exclude-rules:
12+
# Exclude some linters from running on tests files.
13+
- path: _test\.go
14+
linters:
15+
- errcheck

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,25 @@ GOCLEAN=$(GOCMD) clean
66
GOTEST=$(GOCMD) test
77
GOGET=$(GOCMD) get
88
GOMOD=$(GOCMD) mod
9+
GOFMT=$(GOCMD) fmt
910

1011
.PHONY: all test coverage
1112
all: test coverage
1213

14+
checkfmt:
15+
@echo 'Checking gofmt';\
16+
bash -c "diff -u <(echo -n) <(gofmt -d .)";\
17+
EXIT_CODE=$$?;\
18+
if [ "$$EXIT_CODE" -ne 0 ]; then \
19+
echo '$@: Go files must be formatted with gofmt'; \
20+
fi && \
21+
exit $$EXIT_CODE
22+
1323
get:
1424
$(GOGET) -t -v ./...
1525

1626
test: get
27+
$(GOFMT) ./...
1728
$(GOTEST) -race -covermode=atomic ./...
1829

1930
coverage: get test

client.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ func NewClientFromPool(pool *redis.Pool, name string) *Client {
4444
return ret
4545
}
4646

47-
// Reserve - Creates an empty Bloom Filter with a given desired error ratio and initial capacity.
47+
// Reserve - Creates an empty Bloom Filter with a given desired error ratio and initial capacity.
4848
// args:
4949
// key - the name of the filter
5050
// error_rate - the desired probability for false positives
51-
// capacity - the number of entries you intend to add to the filter
51+
// capacity - the number of entries you intend to add to the filter
5252
func (client *Client) Reserve(key string, error_rate float64, capacity uint64) (err error) {
5353
conn := client.Pool.Get()
5454
defer conn.Close()
@@ -58,27 +58,27 @@ func (client *Client) Reserve(key string, error_rate float64, capacity uint64) (
5858

5959
// Add - Add (or create and add) a new value to the filter
6060
// args:
61-
// key - the name of the filter
62-
// item - the item to add
61+
// key - the name of the filter
62+
// item - the item to add
6363
func (client *Client) Add(key string, item string) (exists bool, err error) {
6464
conn := client.Pool.Get()
6565
defer conn.Close()
6666
return redis.Bool(conn.Do("BF.ADD", key, item))
6767
}
6868

69-
// Exists - Determines whether an item may exist in the Bloom Filter or not.
69+
// Exists - Determines whether an item may exist in the Bloom Filter or not.
7070
// args:
71-
// key - the name of the filter
72-
// item - the item to check for
71+
// key - the name of the filter
72+
// item - the item to check for
7373
func (client *Client) Exists(key string, item string) (exists bool, err error) {
7474
conn := client.Pool.Get()
7575
defer conn.Close()
7676
return redis.Bool(conn.Do("BF.EXISTS", key, item))
7777
}
7878

79-
// Info - Return information about key
79+
// Info - Return information about key
8080
// args:
81-
// key - the name of the filter
81+
// key - the name of the filter
8282
func (client *Client) Info(key string) (info map[string]int64, err error) {
8383
conn := client.Pool.Get()
8484
defer conn.Close()

0 commit comments

Comments
 (0)