diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e3610f..34dff80 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,6 @@ version: 2 jobs: build: docker: - # CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/ - image: circleci/golang:1.14 environment: @@ -16,7 +15,6 @@ jobs: keys: - go-mod-v4-{{ checksum "go.sum" }} - # Make sure it builds first - run: go build - run: @@ -37,8 +35,30 @@ jobs: - store_test_results: path: /tmp/test-results + gofmt: + docker: + - image: circleci/golang:1.14 + + steps: + - checkout + - run: + name: "Enforce Go Formatted Code" + command: test $(gofmt -l . | wc -l) -eq 0 + + govet: + docker: + - image: circleci/golang:1.14 + + steps: + - checkout + - run: + name: "Go vet" + command: go vet ./... + workflows: version: 2 build-workflow: jobs: - build + - gofmt + - govet diff --git a/entry.go b/entry.go index e9721e6..e549123 100644 --- a/entry.go +++ b/entry.go @@ -178,7 +178,7 @@ func (e *Entry) UnmarshalJSON(data []byte) error { } func EntryCommitMessage(e *Entry, ec *ECAddress) (*bytes.Buffer, error) { - buf := new(bytes.Buffer) + buf := new(bytes.Buffer) // 1 byte version buf.Write([]byte{0}) @@ -209,7 +209,7 @@ func EntryCommitMessage(e *Entry, ec *ECAddress) (*bytes.Buffer, error) { // Entry Credit Signature. func ComposeEntryCommit(e *Entry, ec *ECAddress) (*JSON2Request, error) { b, err := EntryCommitMessage(e, ec) - if err != nil { + if err != nil { return nil, err } params := messageRequest{Message: hex.EncodeToString(b.Bytes())}