Skip to content

Commit 6e5ab4c

Browse files
committed
Updated dependencies and fixed style warnings
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.
1 parent 7f81ccd commit 6e5ab4c

File tree

4 files changed

+42
-16
lines changed

4 files changed

+42
-16
lines changed

cmd_serve_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func TestUknownAPIState(t *testing.T) {
9191
t.Errorf("Failed to read response-body %v\n", err)
9292
}
9393

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

253-
content := fmt.Sprintf("%s", body)
253+
content := string(body)
254254

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

333-
content := fmt.Sprintf("%s", body)
333+
content := string(body)
334334

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

660-
content := fmt.Sprintf("%s", body)
660+
content := string(body)
661661

662662
if status := resp.StatusCode; status != http.StatusNotFound {
663663
t.Errorf("Unexpected status-code: %v", status)

db.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func populateEnvironment(prefix string) error {
163163
return errors.New("SetupDB not called")
164164
}
165165

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

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

go.mod

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module github.com/skx/puppet-summary
33
go 1.12
44

55
require (
6-
github.com/google/subcommands v1.0.1
7-
github.com/gorilla/handlers v1.4.0
8-
github.com/gorilla/mux v1.7.0
9-
github.com/marpaia/graphite-golang v0.0.0-20171231172105-134b9af18cf3
10-
github.com/mattn/go-sqlite3 v1.10.0
11-
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967
12-
github.com/skx/golang-metrics v0.0.0-20180606065905-85a4b4e0641f
13-
github.com/smallfish/simpleyaml v0.0.0-20170911015856-a32031077861
14-
gopkg.in/yaml.v2 v2.2.2 // indirect
6+
github.com/felixge/httpsnoop v1.0.2 // indirect
7+
github.com/google/subcommands v1.2.0
8+
github.com/gorilla/handlers v1.5.1
9+
github.com/gorilla/mux v1.8.0
10+
github.com/marpaia/graphite-golang v0.0.0-20190519024811-caf161d2c2b1
11+
github.com/mattn/go-sqlite3 v1.14.8
12+
github.com/robfig/cron v1.2.0
13+
github.com/skx/golang-metrics v0.0.0-20190325085214-453332cf54e8
14+
github.com/smallfish/simpleyaml v0.1.0
1515
)

go.sum

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

0 commit comments

Comments
 (0)