Skip to content

Commit 8d82c0d

Browse files
authored
build: upgrade go to 1.20 (#111)
1 parent f1f2de9 commit 8d82c0d

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

.github/workflows/lint.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v2
1515
- uses: actions/setup-go@v2
1616
with:
17-
go-version: '1.19'
18-
- uses: golangci/golangci-lint-action@v3.2.0
17+
go-version: '1.20'
18+
- uses: golangci/golangci-lint-action@v3.4.0
1919
with:
20-
version: v1.50.0
20+
version: v1.51.1

.github/workflows/test.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- uses: actions/setup-go@v2
2121
with:
22-
go-version: '1.19'
22+
go-version: '1.20'
2323

2424
- uses: actions/checkout@v2
2525

@@ -38,8 +38,8 @@ jobs:
3838
strategy:
3939
matrix:
4040
go_version:
41+
- '1.19'
4142
- '1.18'
42-
- '1.17'
4343

4444
steps:
4545
- uses: actions/setup-go@v2

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax = docker/dockerfile:1.3
2-
FROM golang:1.19 AS build
2+
FROM golang:1.20 AS build
33

44
WORKDIR /go/src/github.com/mccutchen/go-httpbin
55

httpbin/digest/digest.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ package digest
1212

1313
import (
1414
"crypto/md5"
15+
crypto_rand "crypto/rand"
1516
"crypto/sha256"
1617
"crypto/subtle"
1718
"fmt"
18-
"math/rand"
1919
"net/http"
2020
"strings"
2121
"time"
@@ -55,7 +55,7 @@ func Check(req *http.Request, username, password string) bool {
5555
// algorithm. If an invalid realm or an unsupported algorithm is given
5656
func Challenge(realm string, algorithm digestAlgorithm) string {
5757
entropy := make([]byte, 32)
58-
rand.Read(entropy)
58+
crypto_rand.Read(entropy)
5959

6060
opaqueVal := entropy[:16]
6161
nonceVal := fmt.Sprintf("%s:%x", time.Now(), entropy[16:31])

httpbin/handlers_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func assertBodyEquals(t *testing.T, w *httptest.ResponseRecorder, want string) {
9191
}
9292

9393
func randStringBytes(n int) string {
94-
rand.Seed(time.Now().UnixNano())
94+
rand.New(rand.NewSource(time.Now().UnixNano()))
9595
b := make([]byte, n)
9696
for i := range b {
9797
b[i] = alphanumLetters[rand.Intn(len(alphanumLetters))]

httpbin/helpers.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package httpbin
22

33
import (
44
"bytes"
5+
crypto_rand "crypto/rand"
56
"crypto/sha1"
67
"encoding/base64"
78
"encoding/json"
@@ -284,7 +285,7 @@ func sha1hash(input string) string {
284285

285286
func uuidv4() string {
286287
buff := make([]byte, 16)
287-
_, err := rand.Read(buff[:])
288+
_, err := crypto_rand.Read(buff[:])
288289
if err != nil {
289290
panic(err)
290291
}

0 commit comments

Comments
 (0)