Skip to content

Commit

Permalink
format cleanup: gofmt, golang-ci
Browse files Browse the repository at this point in the history
* add & run `make gofmt` to format whole repo
* add goreportcard
* golang-ci: ignore comment issues

fixes #239
refs  #249
  • Loading branch information
boz committed Jun 19, 2018
1 parent 7e05fd9 commit 39f3bfc
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
linters:
enable-all: true

issues:
exclude:
- comment on exported (method|function|type|const|var)
exclude-use-default: true
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ jobs:
- make test-integration
- make image-bins

# linux/1.10 (mainline): print linting errors
- name: test-lint
os: linux
go: "1.10"
allow_failures: true
script:
- make lintdeps-install
- make test-lint
if: type = cron

# linux/master: tests, integration, image-bins
- name: test
os: linux
Expand Down Expand Up @@ -104,6 +114,7 @@ jobs:
matrix:
allow_failures:
- env: TEST_UNSKIP=true
- name: test-lint

cache:
directories:
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ test-full:
test-cover:
goveralls -service=travis-ci -ignore="types/types.pb.go"

test-lint:
golangci-lint run

lintdeps-install:
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

test-vet:
go vet $$(glide novendor | grep -v ./pkg/)

Expand Down Expand Up @@ -91,6 +97,10 @@ mocks:
mockery -case=underscore -dir provider/cluster -output provider/cluster/mocks -name Reservation
mockery -case=underscore -dir provider/manifest -output provider/manifest/mocks -name Handler

gofmt:
find . -not -path './vendor*' -name '*.go' -type f | \
xargs gofmt -s -w

docs:
(cd _docs/dot && make)

Expand All @@ -104,8 +114,10 @@ clean:
deps-install devdeps-install \
test-cover coverdeps-install \
test-integraion integrationdeps-install \
test-lint lintdeps-install \
test-vet \
mocks \
gofmt \
docs \
clean \
kubetypes
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![Akash](_docs/img/logo-label-black.svg "Akash")](#overview)
[![Build Status](https://travis-ci.org/ovrclk/akash.svg?branch=master)](https://travis-ci.org/ovrclk/akash)
[![Coverage Status](https://coveralls.io/repos/github/ovrclk/akash/badge.svg?branch=master)](https://coveralls.io/github/ovrclk/akash?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/ovrclk/akash)](https://goreportcard.com/report/github.com/ovrclk/akash)

# Overview

Expand Down
2 changes: 1 addition & 1 deletion app/account/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestAccountApp(t *testing.T) {

_, cacheState := testutil.NewState(t, &types.Genesis{
Accounts: []types.Account{
types.Account{Address: addrfrom, Balance: balance},
{Address: addrfrom, Balance: balance},
},
})

Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (app *app) DeliverTx(buf []byte) tmtypes.ResponseDeliverTx {
return tmtypes.ResponseDeliverTx{Code: code.INVALID_TRANSACTION, Log: err_.Error()}
}

// XXX: Accouts should be implicity created when tokens are sent to it
// XXX: Accouts should be implicitly created when tokens are sent to it
if signer == nil {
signer = &types.Account{
Address: ctx.Signer().Address().Bytes(),
Expand Down
4 changes: 2 additions & 2 deletions app/store/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func TestStoreApp(t *testing.T) {
{
key := append([]byte(pstate.AccountPath), fromaddr...)
resp := app.Query(state, tmtypes.RequestQuery{
Path: store.QueryPath,
Data: key,
Path: store.QueryPath,
Data: key,
})
acc := new(types.Account)
acc.Unmarshal(resp.Value)
Expand Down
2 changes: 1 addition & 1 deletion cmd/akashd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func generateAkashGenesis(cmd *cobra.Command, args []string) (*ptypes.Genesis, e
}
return &ptypes.Genesis{
Accounts: []ptypes.Account{
ptypes.Account{Address: key.ID(), Balance: maxTokens},
{Address: key.ID(), Balance: maxTokens},
},
}, nil
}
4 changes: 2 additions & 2 deletions provider/event/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ loop:
}

// Publish to children.
for sub, _ := range b.subscriptions {
for sub := range b.subscriptions {
sub.Publish(ev)
}

Expand All @@ -154,7 +154,7 @@ loop:
}
}

for sub, _ := range b.subscriptions {
for sub := range b.subscriptions {
sub.lc.ShutdownAsync(nil)
}

Expand Down
1 change: 1 addition & 0 deletions provider/manifest/http/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ func withServer(t *testing.T, fn func(), h *pmanifest.Handler) {
}()

testutil.SleepForThreadStart(t)

fn()
}
4 changes: 2 additions & 2 deletions sdl/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (sdl *v1) DeploymentGroups() ([]*types.GroupSpec, error) {

// keep ordering stable
names := make([]string, 0, len(groups))
for name, _ := range groups {
for name := range groups {
names = append(names, name)
}
sort.Strings(names)
Expand Down Expand Up @@ -228,7 +228,7 @@ func (sdl *v1) Manifest() (*types.Manifest, error) {

// stable ordering
names := make([]string, 0, len(groups))
for name, _ := range groups {
for name := range groups {
names = append(names, name)
}
sort.Strings(names)
Expand Down

0 comments on commit 39f3bfc

Please sign in to comment.