Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit c041f40

Browse files
authored
Merge pull request #369 from vania-pooh/master
Bump Golang to 1.19.3
2 parents e83d8e5 + 980de9f commit c041f40

File tree

10 files changed

+35
-25
lines changed

10 files changed

+35
-25
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup Golang
1515
uses: actions/setup-go@v2
1616
with:
17-
go-version: 1.18.x
17+
go-version: ~1.19.3
1818

1919
- uses: actions/cache@v1
2020
with:

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Setup Golang
1414
uses: actions/setup-go@v2
1515
with:
16-
go-version: 1.18.x
16+
go-version: ~1.19.3
1717

1818
- uses: actions/cache@v1
1919
with:

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Golang
1313
uses: actions/setup-go@v2
1414
with:
15-
go-version: 1.18.x
15+
go-version: ~1.19.3
1616

1717
- uses: actions/cache@v1
1818
with:

ci/test.sh

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33
export GO111MODULE="on"
44
go test -tags 'watch' -v -race -coverprofile=coverage.txt -covermode=atomic -coverpkg github.com/aerokube/ggr
5+
6+
go install golang.org/x/vuln/cmd/govulncheck@latest
7+
"$(go env GOPATH)"/bin/govulncheck -tags production ./...

config_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"os"
76
"testing"
87

@@ -167,7 +166,7 @@ func TestFindWithPlatformPrefix(t *testing.T) {
167166
}
168167

169168
func TestReadNotExistingConfig(t *testing.T) {
170-
tmp, err := ioutil.TempFile("", "config")
169+
tmp, err := os.CreateTemp("", "config")
171170
if err != nil {
172171
t.Fatal(err)
173172
}
@@ -183,7 +182,7 @@ func TestReadNotExistingConfig(t *testing.T) {
183182
}
184183

185184
func TestParseInvalidConfig(t *testing.T) {
186-
tmp, err := ioutil.TempFile("", "config")
185+
tmp, err := os.CreateTemp("", "config")
187186
defer os.Remove(tmp.Name())
188187
if err != nil {
189188
t.Fatal(err)
@@ -212,7 +211,7 @@ func TestParseConfigWithoutNamespace(t *testing.T) {
212211
}
213212

214213
func testParseConfig(t *testing.T, config string) {
215-
tmp, err := ioutil.TempFile("", "config")
214+
tmp, err := os.CreateTemp("", "config")
216215
defer os.Remove(tmp.Name())
217216
if err != nil {
218217
t.Fatal(err)

go.mod

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
module github.com/aerokube/ggr
22

3-
go 1.18
3+
go 1.19
44

55
require (
6-
github.com/aandryashin/matchers v0.0.0-20160729131923-5eb67beb188b
6+
github.com/aandryashin/matchers v0.0.0-20161126170413-435295ea180e
77
github.com/aandryashin/reloader v0.0.0-20161127125235-da4f1b43ce40
88
github.com/abbot/go-http-auth v0.4.1-0.20220112235402-e1cee1c72f2f
9-
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
9+
golang.org/x/net v0.2.0
1010
)
1111

1212
require (
1313
github.com/fsnotify/fsnotify v1.5.4 // indirect
1414
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
15-
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
15+
golang.org/x/sys v0.2.0 // indirect
1616
)

go.sum

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
github.com/aandryashin/matchers v0.0.0-20160729131923-5eb67beb188b h1:2hJ49uel4j48uteFY3ybBiSB35Ml86IZkSXAb+rj0lQ=
22
github.com/aandryashin/matchers v0.0.0-20160729131923-5eb67beb188b/go.mod h1:cbmYNkm9xeQlNoWEPtOUcvNok2gSD7ErMnYkRW+eHi8=
3+
github.com/aandryashin/matchers v0.0.0-20161126170413-435295ea180e h1:ogUKYFNcdYUIBSLibE4+EjbTJazoHr5JsWWx21Lpn8c=
4+
github.com/aandryashin/matchers v0.0.0-20161126170413-435295ea180e/go.mod h1:cbmYNkm9xeQlNoWEPtOUcvNok2gSD7ErMnYkRW+eHi8=
35
github.com/aandryashin/reloader v0.0.0-20161127125235-da4f1b43ce40 h1:zSKVi4h3Kv0HvNGjWPOsOEJIxtvd3PRMlVA/fcCB45g=
46
github.com/aandryashin/reloader v0.0.0-20161127125235-da4f1b43ce40/go.mod h1:gvg2/m9OQ4ZwK4Qk/mnfgokCb4qDN4BGyle+QGw4VOc=
57
github.com/abbot/go-http-auth v0.4.1-0.20220112235402-e1cee1c72f2f h1:R2ZVGCZzU95oXFJxncosHS9LsX8N4/MYUdGGWOb2cFk=
@@ -10,11 +12,15 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5U
1012
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
1113
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
1214
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
15+
golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU=
16+
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
1317
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1418
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1519
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1620
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
1721
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
22+
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
23+
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1824
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
1925
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
2026
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

main.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ func init() {
111111
go func() {
112112
for {
113113
<-sig
114-
loadQuotaFiles(quotaDir)
114+
err := loadQuotaFiles(quotaDir)
115+
if err != nil {
116+
log.Printf("[-] [-] [INIT] [-] [-] [-] [-] [-] [-] [%v]\n", err)
117+
}
115118
}
116119
}()
117120
}

proxy.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import (
77
"encoding/xml"
88
"fmt"
99
"io"
10-
"io/ioutil"
1110
"log"
1211
"net"
1312
"net/http"
1413
"net/http/httputil"
1514
"net/url"
15+
"os"
1616
"reflect"
1717
"strings"
1818
"sync"
@@ -421,15 +421,15 @@ func proxy(w http.ResponseWriter, r *http.Request) {
421421
confLock.RUnlock()
422422
if ok {
423423
if r.Body != nil {
424-
if body, err := ioutil.ReadAll(r.Body); err == nil {
424+
if body, err := io.ReadAll(r.Body); err == nil {
425425
r.Body.Close()
426426
var msg map[string]interface{}
427427
if err := json.Unmarshal(body, &msg); err == nil {
428428
delete(msg, "sessionId")
429429
body, _ = json.Marshal(msg)
430430
r.ContentLength = int64(len(body))
431431
}
432-
r.Body = ioutil.NopCloser(bytes.NewReader(body))
432+
r.Body = io.NopCloser(bytes.NewReader(body))
433433
}
434434
}
435435
if h.Scheme != "" {
@@ -570,7 +570,7 @@ func withCloseNotifier(handler http.HandlerFunc) http.HandlerFunc {
570570
}
571571

572572
func readConfig(fn string, browsers *Browsers) error {
573-
file, err := ioutil.ReadFile(fn)
573+
file, err := os.ReadFile(fn)
574574
if err != nil {
575575
return fmt.Errorf("error reading configuration file %s: %v", fn, err)
576576
}
@@ -625,7 +625,7 @@ func requireBasicAuth(authenticator *auth.BasicAuth, handler func(http.ResponseW
625625
})
626626
}
627627

628-
//WithSuitableAuthentication handles basic authentication and guest quota processing
628+
// WithSuitableAuthentication handles basic authentication and guest quota processing
629629
func WithSuitableAuthentication(authenticator *auth.BasicAuth, handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) {
630630
return func(w http.ResponseWriter, r *http.Request) {
631631
if rootToken != "" {

proxy_test.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
87
"net"
98
"net/http"
109
"net/http/httptest"
@@ -100,7 +99,7 @@ func TestPing(t *testing.T) {
10099
AssertThat(t, rsp.Body, Is{Not{nil}})
101100

102101
var data map[string]interface{}
103-
bt, readErr := ioutil.ReadAll(rsp.Body)
102+
bt, readErr := io.ReadAll(rsp.Body)
104103
AssertThat(t, readErr, Is{nil})
105104
jsonErr := json.Unmarshal(bt, &data)
106105
AssertThat(t, jsonErr, Is{nil})
@@ -125,7 +124,7 @@ func TestStatus(t *testing.T) {
125124
AssertThat(t, rsp.Body, Is{Not{nil}})
126125

127126
var data map[string]interface{}
128-
bt, readErr := ioutil.ReadAll(rsp.Body)
127+
bt, readErr := io.ReadAll(rsp.Body)
129128
AssertThat(t, readErr, Is{nil})
130129
jsonErr := json.Unmarshal(bt, &data)
131130
AssertThat(t, jsonErr, Is{nil})
@@ -785,7 +784,7 @@ func TestStartSessionWithOverriddenBasicAuth(t *testing.T) {
785784
func TestStartSessionWithPrefixVersion(t *testing.T) {
786785
mux := http.NewServeMux()
787786
mux.HandleFunc("/wd/hub/session", postOnly(func(w http.ResponseWriter, r *http.Request) {
788-
body, _ := ioutil.ReadAll(r.Body)
787+
body, _ := io.ReadAll(r.Body)
789788
r.Body.Close()
790789
var sess map[string]map[string]string
791790
err := json.Unmarshal(body, &sess)
@@ -839,7 +838,7 @@ func TestCreateSessionW3CBrowserNotSet2(t *testing.T) {
839838
func TestStartSessionWithDefaultVersion(t *testing.T) {
840839
mux := http.NewServeMux()
841840
mux.HandleFunc("/wd/hub/session", postOnly(func(w http.ResponseWriter, r *http.Request) {
842-
body, _ := ioutil.ReadAll(r.Body)
841+
body, _ := io.ReadAll(r.Body)
843842
r.Body.Close()
844843
w.Write([]byte(`{"sessionId":"123"}`))
845844
var sess map[string]map[string]string
@@ -878,7 +877,7 @@ func TestStartSessionWithDefaultVersion(t *testing.T) {
878877
func TestStartSessionWithDefaultVersionW3C(t *testing.T) {
879878
mux := http.NewServeMux()
880879
mux.HandleFunc("/wd/hub/session", postOnly(func(w http.ResponseWriter, r *http.Request) {
881-
body, _ := ioutil.ReadAll(r.Body)
880+
body, _ := io.ReadAll(r.Body)
882881
r.Body.Close()
883882
var sess map[string]map[string]map[string]interface{}
884883
err := json.Unmarshal(body, &sess)
@@ -1416,7 +1415,7 @@ func TestProxyJsonRequest(t *testing.T) {
14161415
func TestProxyPlainRequest(t *testing.T) {
14171416
mux := http.NewServeMux()
14181417
mux.HandleFunc("/wd/hub/session/", func(w http.ResponseWriter, r *http.Request) {
1419-
body, _ := ioutil.ReadAll(r.Body)
1418+
body, _ := io.ReadAll(r.Body)
14201419
r.Body.Close()
14211420
AssertThat(t, string(body), EqualTo{"request"})
14221421
})
@@ -1685,7 +1684,7 @@ func TestFileExists(t *testing.T) {
16851684
tmpDir := os.TempDir()
16861685
AssertThat(t, fileExists(tmpDir), Is{false})
16871686
AssertThat(t, fileExists(filepath.Join(tmpDir, "missing-file")), Is{false})
1688-
f, err := ioutil.TempFile(tmpDir, "testfile")
1687+
f, err := os.CreateTemp(tmpDir, "testfile")
16891688
AssertThat(t, err, Is{nil})
16901689
AssertThat(t, fileExists(f.Name()), Is{true})
16911690
}

0 commit comments

Comments
 (0)