Sfoglia il codice sorgente

upgrade go to 1.16

Fixes #1510
tags/v2.6.0-rc1
Shivaram Lingamneni 3 anni fa
parent
commit
430b40fc2f
10 ha cambiato i file con 18 aggiunte e 21 eliminazioni
  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 Vedi File

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

+ 1
- 1
Dockerfile Vedi File

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

+ 1
- 1
go.mod Vedi File

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

+ 3
- 3
irc/config.go Vedi File

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

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

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

+ 2
- 2
irc/import.go Vedi File

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

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

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

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

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

+ 1
- 1
irc/listeners.go Vedi File

100
 			} else {
100
 			} else {
101
 				nl.server.logger.Error("internal", "invalid connection type", nl.addr)
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
 			return
104
 			return
105
 		} else {
105
 		} else {
106
 			nl.server.logger.Error("internal", "accept error", nl.addr, err.Error())
106
 			nl.server.logger.Error("internal", "accept error", nl.addr, err.Error())

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

6
 import (
6
 import (
7
 	"crypto/tls"
7
 	"crypto/tls"
8
 	"encoding/binary"
8
 	"encoding/binary"
9
-	"errors"
10
 	"io"
9
 	"io"
11
 	"net"
10
 	"net"
12
 	"strings"
11
 	"strings"
39
 
38
 
40
 var (
39
 var (
41
 	ErrBadProxyLine error = &proxyLineError{}
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
 // ListenerConfig is all the information about how to process
43
 // ListenerConfig is all the information about how to process
253
 		if err == nil {
250
 		if err == nil {
254
 			conn.Close()
251
 			conn.Close()
255
 		}
252
 		}
256
-		err = ErrNetClosing
253
+		err = net.ErrClosed
257
 	}
254
 	}
258
 	if err != nil {
255
 	if err != nil {
259
 		return nil, err
256
 		return nil, err

Loading…
Annulla
Salva