Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #494 from raintank/force-gofmt-simplified
Browse files Browse the repository at this point in the history
fail build if code is not formatted and simplified
  • Loading branch information
Dieterbe authored Jan 23, 2017
2 parents 897d5dc + 3e050bb commit 9ac3c8f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ test:
override:
- cd $IMPORTPATH && go test -v -race $(go list ./... | grep -v /vendor/)
- cd $IMPORTPATH && go vet $(go list ./... | grep -v /vendor/)
- cd $IMPORTPATH && scripts/gofmt-check.sh
- cd $IMPORTPATH && scripts/end2end_test.sh
- cd $IMPORTPATH && go test -v -run='^$' -bench=. $(go list ./... | grep -v /vendor/)
post:
Expand Down
2 changes: 1 addition & 1 deletion cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var (
func Init(name, version string, started time.Time, apiScheme string, apiPort int) {
Manager = &ClusterManager{
members: map[string]Node{
name: Node{
name: {
Name: name,
ApiPort: apiPort,
ApiScheme: apiScheme,
Expand Down
6 changes: 3 additions & 3 deletions cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ func TestPeersForQuery(t *testing.T) {
Mode = ModeMulti
Manager.members = map[string]Node{
thisNode.Name: thisNode,
"node2": Node{
"node2": {
Name: "node2",
Primary: true,
Partitions: []int32{1, 2},
State: NodeReady,
},
"node3": Node{
"node3": {
Name: "node3",
Primary: true,
Partitions: []int32{3, 4},
State: NodeReady,
},
"node4": Node{
"node4": {
Name: "node4",
Primary: true,
Partitions: []int32{3, 4},
Expand Down
2 changes: 1 addition & 1 deletion kafka/partitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Iter:
func GetPartitions(client sarama.Client, topics []string) ([]int32, error) {
partitionCount := 0
partitions := make([]int32, 0)
var err error
var err error
for i, topic := range topics {
partitions, err = client.Partitions(topic)
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions scripts/gofmt-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
out=$(gofmt -d -s $(find . -name '*.go' | grep -v vendor | grep -v _gen.go))
if [ "$out" != "" ]; then
echo "$out"
echo
echo "You might want to run something like 'find . -name '*.go' | xargs gofmt -w -s'"
exit 2
fi
exit 0

0 comments on commit 9ac3c8f

Please sign in to comment.