Browse Source

upgrade go to 1.16

Fixes #1510
tags/v2.6.0-rc1
Shivaram Lingamneni 3 years ago
parent
commit
430b40fc2f
10 changed files with 18 additions and 21 deletions
  1. 1
    1
      .travis.yml
  2. 1
    1
      Dockerfile
  3. 1
    1
      go.mod
  4. 3
    3
      irc/config.go
  5. 2
    2
      irc/email/dkim.go
  6. 2
    2
      irc/import.go
  7. 2
    2
      irc/jwt/extjwt.go
  8. 4
    4
      irc/languages/languages.go
  9. 1
    1
      irc/listeners.go
  10. 1
    4
      irc/utils/proxy.go

+ 1
- 1
.travis.yml View File

@@ -3,7 +3,7 @@ language: go
3 3
 dist: focal
4 4
 
5 5
 go:
6
-    - "1.15.x"
6
+    - "1.16.x"
7 7
 
8 8
 branches:
9 9
   only:

+ 1
- 1
Dockerfile View File

@@ -1,5 +1,5 @@
1 1
 ## build Oragono
2
-FROM golang:1.15-alpine AS build-env
2
+FROM golang:1.16-alpine AS build-env
3 3
 
4 4
 RUN apk add --no-cache git make curl sed
5 5
 

+ 1
- 1
go.mod View File

@@ -1,6 +1,6 @@
1 1
 module github.com/oragono/oragono
2 2
 
3
-go 1.15
3
+go 1.16
4 4
 
5 5
 require (
6 6
 	code.cloudfoundry.org/bytefmt v0.0.0-20200131002437-cf55d5288a48

+ 3
- 3
irc/config.go View File

@@ -10,7 +10,7 @@ import (
10 10
 	"crypto/tls"
11 11
 	"errors"
12 12
 	"fmt"
13
-	"io/ioutil"
13
+	"io"
14 14
 	"log"
15 15
 	"net"
16 16
 	"os"
@@ -917,7 +917,7 @@ func (config *Config) processExtjwt() (err error) {
917 917
 
918 918
 // LoadRawConfig loads the config without doing any consistency checks or postprocessing
919 919
 func LoadRawConfig(filename string) (config *Config, err error) {
920
-	data, err := ioutil.ReadFile(filename)
920
+	data, err := os.ReadFile(filename)
921 921
 	if err != nil {
922 922
 		return nil, err
923 923
 	}
@@ -1598,7 +1598,7 @@ func (config *Config) loadMOTD() error {
1598 1598
 			return err
1599 1599
 		}
1600 1600
 		defer file.Close()
1601
-		contents, err := ioutil.ReadAll(file)
1601
+		contents, err := io.ReadAll(file)
1602 1602
 		if err != nil {
1603 1603
 			return err
1604 1604
 		}

+ 2
- 2
irc/email/dkim.go View File

@@ -6,7 +6,7 @@ package email
6 6
 import (
7 7
 	"errors"
8 8
 	dkim "github.com/toorop/go-dkim"
9
-	"io/ioutil"
9
+	"os"
10 10
 )
11 11
 
12 12
 var (
@@ -25,7 +25,7 @@ func (dkim *DKIMConfig) Postprocess() (err error) {
25 25
 		if dkim.Selector == "" || dkim.KeyFile == "" {
26 26
 			return ErrMissingFields
27 27
 		}
28
-		dkim.keyBytes, err = ioutil.ReadFile(dkim.KeyFile)
28
+		dkim.keyBytes, err = os.ReadFile(dkim.KeyFile)
29 29
 		if err != nil {
30 30
 			return err
31 31
 		}

+ 2
- 2
irc/import.go View File

@@ -6,8 +6,8 @@ package irc
6 6
 import (
7 7
 	"encoding/json"
8 8
 	"fmt"
9
-	"io/ioutil"
10 9
 	"log"
10
+	"os"
11 11
 	"strconv"
12 12
 
13 13
 	"github.com/tidwall/buntdb"
@@ -215,7 +215,7 @@ func doImportDB(config *Config, dbImport databaseImport, tx *buntdb.Tx) (err err
215 215
 }
216 216
 
217 217
 func ImportDB(config *Config, infile string) (err error) {
218
-	data, err := ioutil.ReadFile(infile)
218
+	data, err := os.ReadFile(infile)
219 219
 	if err != nil {
220 220
 		return
221 221
 	}

+ 2
- 2
irc/jwt/extjwt.go View File

@@ -10,7 +10,7 @@ import (
10 10
 	"encoding/pem"
11 11
 	"errors"
12 12
 	"fmt"
13
-	"io/ioutil"
13
+	"os"
14 14
 	"time"
15 15
 
16 16
 	"github.com/dgrijalva/jwt-go"
@@ -34,7 +34,7 @@ func (t *JwtServiceConfig) Postprocess() (err error) {
34 34
 	t.secretBytes = []byte(t.Secret)
35 35
 	t.Secret = ""
36 36
 	if t.RSAPrivateKeyFile != "" {
37
-		keyBytes, err := ioutil.ReadFile(t.RSAPrivateKeyFile)
37
+		keyBytes, err := os.ReadFile(t.RSAPrivateKeyFile)
38 38
 		if err != nil {
39 39
 			return err
40 40
 		}

+ 4
- 4
irc/languages/languages.go View File

@@ -6,7 +6,7 @@ package languages
6 6
 import (
7 7
 	"encoding/json"
8 8
 	"fmt"
9
-	"io/ioutil"
9
+	"os"
10 10
 	"path/filepath"
11 11
 	"sort"
12 12
 	"strconv"
@@ -72,7 +72,7 @@ func NewManager(enabled bool, path string, defaultLang string) (lm *Manager, err
72 72
 }
73 73
 
74 74
 func (lm *Manager) loadData(path string) (err error) {
75
-	files, err := ioutil.ReadDir(path)
75
+	files, err := os.ReadDir(path)
76 76
 	if err != nil {
77 77
 		return
78 78
 	}
@@ -93,7 +93,7 @@ func (lm *Manager) loadData(path string) (err error) {
93 93
 
94 94
 		// load, e.g., `zh-CN.lang.yaml`
95 95
 		var data []byte
96
-		data, err = ioutil.ReadFile(filepath.Join(path, name))
96
+		data, err = os.ReadFile(filepath.Join(path, name))
97 97
 		if err != nil {
98 98
 			return
99 99
 		}
@@ -117,7 +117,7 @@ func (lm *Manager) loadData(path string) (err error) {
117 117
 		translations := make(map[string]string)
118 118
 		for _, translationSuffix := range stringsFileSuffixes {
119 119
 			stringsFilePath := filepath.Join(path, prefix+translationSuffix)
120
-			data, err = ioutil.ReadFile(stringsFilePath)
120
+			data, err = os.ReadFile(stringsFilePath)
121 121
 			if err != nil {
122 122
 				continue // skip missing paths
123 123
 			}

+ 1
- 1
irc/listeners.go View File

@@ -100,7 +100,7 @@ func (nl *NetListener) serve() {
100 100
 			} else {
101 101
 				nl.server.logger.Error("internal", "invalid connection type", nl.addr)
102 102
 			}
103
-		} else if err == utils.ErrNetClosing {
103
+		} else if err == net.ErrClosed {
104 104
 			return
105 105
 		} else {
106 106
 			nl.server.logger.Error("internal", "accept error", nl.addr, err.Error())

+ 1
- 4
irc/utils/proxy.go View File

@@ -6,7 +6,6 @@ package utils
6 6
 import (
7 7
 	"crypto/tls"
8 8
 	"encoding/binary"
9
-	"errors"
10 9
 	"io"
11 10
 	"net"
12 11
 	"strings"
@@ -39,8 +38,6 @@ func (p *proxyLineError) Temporary() bool {
39 38
 
40 39
 var (
41 40
 	ErrBadProxyLine error = &proxyLineError{}
42
-	// TODO(golang/go#4373): replace this with the stdlib ErrNetClosing
43
-	ErrNetClosing = errors.New("use of closed network connection")
44 41
 )
45 42
 
46 43
 // ListenerConfig is all the information about how to process
@@ -253,7 +250,7 @@ func (rl *ReloadableListener) Accept() (conn net.Conn, err error) {
253 250
 		if err == nil {
254 251
 			conn.Close()
255 252
 		}
256
-		err = ErrNetClosing
253
+		err = net.ErrClosed
257 254
 	}
258 255
 	if err != nil {
259 256
 		return nil, err

Loading…
Cancel
Save