Skip to content

Commit

Permalink
Updating the version of go in golangci.yml, fixing the linters and ad…
Browse files Browse the repository at this point in the history
…ded unreleased changelog
  • Loading branch information
dianadevasia committed Mar 12, 2024
1 parent b7eaa2c commit 54f1c83
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
run:
go: "1.15"
go: "1.22"
linters:
disable-all: true
enable:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# [Unreleased]
* Updated go version to 1.22.1 to fix 3 CVEs
* Updated the version of golangci to 1.56.2 and disabled depguard rule in golangci

# [2.8.0] - 2024-02-27

Expand Down
6 changes: 3 additions & 3 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package toxiproxy_test
import (
"bytes"
"flag"
"io/ioutil"
"io"
"net/http"
"os"
"testing"
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestPopulateDefaultEnabled(t *testing.T) {
defer resp.Body.Close()

if resp.StatusCode != http.StatusCreated {
message, _ := ioutil.ReadAll(resp.Body)
message, _ := io.ReadAll(resp.Body)
t.Fatalf("Failed to populate proxy list: HTTP %s\n%s", resp.Status, string(message))
}

Expand Down Expand Up @@ -1098,7 +1098,7 @@ func TestVersionEndpointReturnsVersion(t *testing.T) {
}
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
t.Fatal("Unable to read body from response")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func run() error {
return nil
}

rand.Seed(cli.seed)
rand.New(rand.NewSource(cli.seed)) // #nosec G404 -- ignoring this rule

logger := setupLogger()
log.Logger = logger
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/benchmark_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"io/ioutil"
"io"
"net/http"
"testing"
)
Expand Down Expand Up @@ -38,7 +38,7 @@ func BenchmarkDirect(b *testing.B) {
if err != nil {
b.Fatal(err)
}
_, err = ioutil.ReadAll(resp.Body)
_, err = io.ReadAll(resp.Body)
if err != nil {
b.Fatal(err)
}
Expand All @@ -55,7 +55,7 @@ func BenchmarkProxy(b *testing.B) {
if err != nil {
b.Fatal(err)
}
_, err = ioutil.ReadAll(resp.Body)
_, err = io.ReadAll(resp.Body)
if err != nil {
b.Fatal(err)
}
Expand All @@ -72,7 +72,7 @@ func BenchmarkDirectSmall(b *testing.B) {
if err != nil {
b.Fatal(err)
}
_, err = ioutil.ReadAll(resp.Body)
_, err = io.ReadAll(resp.Body)
if err != nil {
b.Fatal(err)
}
Expand All @@ -89,7 +89,7 @@ func BenchmarkProxySmall(b *testing.B) {
if err != nil {
b.Fatal(err)
}
_, err = ioutil.ReadAll(resp.Body)
_, err = io.ReadAll(resp.Body)
if err != nil {
b.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions testhelper/tcp_server.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package testhelper

import (
"io/ioutil"
"io"
"net"
"testing"
)
Expand Down Expand Up @@ -40,7 +40,7 @@ func (server *TCPServer) handle_connection() (err error) {
}
defer conn.Close()

val, err := ioutil.ReadAll(conn)
val, err := io.ReadAll(conn)
if err != nil {
return
}
Expand Down

0 comments on commit 54f1c83

Please sign in to comment.