From 3a0d801a183f4cb6c60645b50f461a532f0bccd9 Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Fri, 17 Jan 2020 16:24:54 -0500 Subject: [PATCH] Fix goreportcard (#5) * gofmt * golint * adjust action * fixup * rename --- .github/workflows/{push.yml => action.yml} | 7 ++++--- cmd/api.go | 4 ++-- cmd/api_test.go | 4 ++-- cmd/config.go | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) rename .github/workflows/{push.yml => action.yml} (59%) diff --git a/.github/workflows/push.yml b/.github/workflows/action.yml similarity index 59% rename from .github/workflows/push.yml rename to .github/workflows/action.yml index e9a73c9..7524e54 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/action.yml @@ -1,10 +1,11 @@ on: push -name: build +name: Go Actions jobs: go-test: name: Go Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: go1.12 test + - name: setup + uses: actions/checkout@master + - name: tests uses: shoukoo/golang-pipeline/go1.12/test@master diff --git a/cmd/api.go b/cmd/api.go index 6086fa9..2358770 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -52,8 +52,8 @@ func handleRecordResponse(response *http.Response) string { responseData, _ := ioutil.ReadAll(response.Body) var responseObject schema.Response json.Unmarshal(responseData, &responseObject) - var gameCount int = 0 - var winRecord int = 0 + var gameCount int + var winRecord int for i := 0; i < len(responseObject.Data); i++ { if responseObject.Data[i].VisitorTeamScore != 0 || responseObject.Data[i].HomeTeamScore != 0 { var visitorScore int = responseObject.Data[i].VisitorTeamScore diff --git a/cmd/api_test.go b/cmd/api_test.go index f30714d..c6c72a0 100644 --- a/cmd/api_test.go +++ b/cmd/api_test.go @@ -37,7 +37,7 @@ func TestBuildURL(t *testing.T) { func TestHandleNextResponse(t *testing.T) { dummy := schema.Response{ Data: []schema.Game{ - schema.Game{ + { ID: 1, Date: "2018-10-16T00:00:00.000Z", HomeTeamScore: 123, @@ -88,7 +88,7 @@ func TestHandleNextResponse(t *testing.T) { func TestHandleRecordResponse(t *testing.T) { dummy := schema.Response{ Data: []schema.Game{ - schema.Game{ + { ID: 1, Date: "2018-10-16T00:00:00.000Z", HomeTeamScore: 122, diff --git a/cmd/config.go b/cmd/config.go index 27859ea..5d896af 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -1,4 +1,5 @@ package cmd + /* Copyright © 2019 Graham Plata