Skip to content

Commit

Permalink
Updated dependencies and fixed style warnings
Browse files Browse the repository at this point in the history
A new version of `staticcheck` started reporting linter failures:

> cmd_serve_test.go:94:14: the argument's underlying type is a slice of bytes, should use a simple conversion instead of fmt.Sprintf (S1025)
> cmd_serve_test.go:253:14: the argument's underlying type is a slice of bytes, should use a simple conversion instead of fmt.Sprintf (S1025)
> cmd_serve_test.go:333:14: the argument's underlying type is a slice of bytes, should use a simple conversion instead of fmt.Sprintf (S1025)
> cmd_serve_test.go:660:13: the argument's underlying type is a slice of bytes, should use a simple conversion instead of fmt.Sprintf (S1025)
> db.go:166:10: should omit type map[int]string from declaration; it will be inferred from the right-hand side (ST1023)

Resolve those, and bump our dependencies at the same time.
  • Loading branch information
skx committed Aug 1, 2021
1 parent 7f81ccd commit 6e5ab4c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
8 changes: 4 additions & 4 deletions cmd_serve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestUknownAPIState(t *testing.T) {
t.Errorf("Failed to read response-body %v\n", err)
}

content := fmt.Sprintf("%s", body)
content := string(body)
if status := resp.StatusCode; status != http.StatusInternalServerError {
t.Errorf("Unexpected status-code: %v", status)
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func TestKnownAPIState(t *testing.T) {
t.Errorf("Failed to read response-body %v\n", err)
}

content := fmt.Sprintf("%s", body)
content := string(body)

if status := resp.StatusCode; status != http.StatusOK {
t.Errorf("Unexpected status-code: %v", status)
Expand Down Expand Up @@ -330,7 +330,7 @@ func TestAPITypes(t *testing.T) {
t.Errorf("Failed to read response-body %v\n", err)
}

content := fmt.Sprintf("%s", body)
content := string(body)

if status := resp.StatusCode; status != http.StatusOK {
t.Errorf("Unexpected status-code: %v", status)
Expand Down Expand Up @@ -657,7 +657,7 @@ func TestUnknownNode(t *testing.T) {
t.Errorf("Failed to read response-body %v\n", err)
}

content := fmt.Sprintf("%s", body)
content := string(body)

if status := resp.StatusCode; status != http.StatusNotFound {
t.Errorf("Unexpected status-code: %v", status)
Expand Down
6 changes: 3 additions & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func populateEnvironment(prefix string) error {
return errors.New("SetupDB not called")
}

var ids map[int]string = make(map[int]string)
ids := make(map[int]string)
rows, err := db.Query("SELECT id,yaml_file FROM reports WHERE environment IS NULL")
if err != nil {
return err
Expand Down Expand Up @@ -711,7 +711,7 @@ func getHistory(environment string) ([]PuppetHistory, error) {
//
// Now we have all the unique dates in `dates`.
//
loc,_ := time.LoadLocation("Local")
loc, _ := time.LoadLocation("Local")
for _, known := range dates {

//
Expand All @@ -722,7 +722,7 @@ func getHistory(environment string) ([]PuppetHistory, error) {
x.Unchanged = "0"
x.Failed = "0"
x.Date = known
formatTime,_:=time.ParseInLocation("02/01/2006 15:04:05", known + " 00:00:00", loc)
formatTime, _ := time.ParseInLocation("02/01/2006 15:04:05", known+" 00:00:00", loc)
ts1 := formatTime.Unix()
ts2 := ts1 + 3600*24 - 1

Expand Down
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ module github.com/skx/puppet-summary
go 1.12

require (
github.com/google/subcommands v1.0.1
github.com/gorilla/handlers v1.4.0
github.com/gorilla/mux v1.7.0
github.com/marpaia/graphite-golang v0.0.0-20171231172105-134b9af18cf3
github.com/mattn/go-sqlite3 v1.10.0
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967
github.com/skx/golang-metrics v0.0.0-20180606065905-85a4b4e0641f
github.com/smallfish/simpleyaml v0.0.0-20170911015856-a32031077861
gopkg.in/yaml.v2 v2.2.2 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/google/subcommands v1.2.0
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/marpaia/graphite-golang v0.0.0-20190519024811-caf161d2c2b1
github.com/mattn/go-sqlite3 v1.14.8
github.com/robfig/cron v1.2.0
github.com/skx/golang-metrics v0.0.0-20190325085214-453332cf54e8
github.com/smallfish/simpleyaml v0.1.0
)
26 changes: 26 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=
github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/google/subcommands v1.0.1 h1:/eqq+otEXm5vhfBrbREPCSVQbvofip6kIz+mX5TUH7k=
github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE=
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/gorilla/handlers v1.4.0 h1:XulKRWSQK5uChr4pEgSE4Tc/OcmnU9GJuSwdog/tZsA=
github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U=
github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/marpaia/graphite-golang v0.0.0-20171231172105-134b9af18cf3 h1:u29lpVaZAUUD6NlG1A0lIR7CnRgKlHNdDOJZw40L+/I=
github.com/marpaia/graphite-golang v0.0.0-20171231172105-134b9af18cf3/go.mod h1:llZw8JbFm5CvdRrtgdjaQNlZR1bQhAWsBKtb0HTX+sw=
github.com/marpaia/graphite-golang v0.0.0-20190519024811-caf161d2c2b1 h1:lODGHy+2Namopi4v7AeiqW106eo4QMXqj9aE8jVXcO4=
github.com/marpaia/graphite-golang v0.0.0-20190519024811-caf161d2c2b1/go.mod h1:llZw8JbFm5CvdRrtgdjaQNlZR1bQhAWsBKtb0HTX+sw=
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU=
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967 h1:x7xEyJDP7Hv3LVgvWhzioQqbC/KtuUhTigKlH/8ehhE=
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/skx/golang-metrics v0.0.0-20180606065905-85a4b4e0641f h1:hfW+6CozS1gFV+SQ5Y/FoDefrQzs0/zRPmwugf/7xLs=
github.com/skx/golang-metrics v0.0.0-20180606065905-85a4b4e0641f/go.mod h1:ZX+VTMGkg8m8Da1GxWKj3bDaGIt08Qi6QSx8HlGxT6g=
github.com/skx/golang-metrics v0.0.0-20190325085214-453332cf54e8 h1:NVwRIqHO7J7vnKGbTz5dBwWjl5Wr6mR1U8JQ32tw7vk=
github.com/skx/golang-metrics v0.0.0-20190325085214-453332cf54e8/go.mod h1:P+OUoQPrBQUZg9lbHEu7iJsZYTC5Na4qghTSs5ZmTA4=
github.com/smallfish/simpleyaml v0.0.0-20170911015856-a32031077861 h1:9z0Ip656Pc+3cj/BpHkErOVg4iE0xcAdvJwfA3hMVzU=
github.com/smallfish/simpleyaml v0.0.0-20170911015856-a32031077861/go.mod h1:eGZ1jp5PTJ+XVhTErUmw0xyPbgctPFlixWPypUrDkSs=
github.com/smallfish/simpleyaml v0.1.0 h1:5uAZdLAiHxS9cmzkOxg7lH0dILXKTD7uRZbAhyHmyU0=
github.com/smallfish/simpleyaml v0.1.0/go.mod h1:gU3WdNn44dQVAbVHD2SrSqKKCvmzFApWD2UURhgEj1M=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 comments on commit 6e5ab4c

Please sign in to comment.