3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 05:19:25 +01:00

upgrade go to 1.16

Fixes #1510
This commit is contained in:
Shivaram Lingamneni 2021-02-17 15:11:54 -05:00
parent dc4214a8ca
commit 430b40fc2f
10 changed files with 18 additions and 21 deletions

View File

@ -3,7 +3,7 @@ language: go
dist: focal
go:
- "1.15.x"
- "1.16.x"
branches:
only:

View File

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

2
go.mod
View File

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

View File

@ -10,7 +10,7 @@ import (
"crypto/tls"
"errors"
"fmt"
"io/ioutil"
"io"
"log"
"net"
"os"
@ -917,7 +917,7 @@ func (config *Config) processExtjwt() (err error) {
// LoadRawConfig loads the config without doing any consistency checks or postprocessing
func LoadRawConfig(filename string) (config *Config, err error) {
data, err := ioutil.ReadFile(filename)
data, err := os.ReadFile(filename)
if err != nil {
return nil, err
}
@ -1598,7 +1598,7 @@ func (config *Config) loadMOTD() error {
return err
}
defer file.Close()
contents, err := ioutil.ReadAll(file)
contents, err := io.ReadAll(file)
if err != nil {
return err
}

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ package languages
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strconv"
@ -72,7 +72,7 @@ func NewManager(enabled bool, path string, defaultLang string) (lm *Manager, err
}
func (lm *Manager) loadData(path string) (err error) {
files, err := ioutil.ReadDir(path)
files, err := os.ReadDir(path)
if err != nil {
return
}
@ -93,7 +93,7 @@ func (lm *Manager) loadData(path string) (err error) {
// load, e.g., `zh-CN.lang.yaml`
var data []byte
data, err = ioutil.ReadFile(filepath.Join(path, name))
data, err = os.ReadFile(filepath.Join(path, name))
if err != nil {
return
}
@ -117,7 +117,7 @@ func (lm *Manager) loadData(path string) (err error) {
translations := make(map[string]string)
for _, translationSuffix := range stringsFileSuffixes {
stringsFilePath := filepath.Join(path, prefix+translationSuffix)
data, err = ioutil.ReadFile(stringsFilePath)
data, err = os.ReadFile(stringsFilePath)
if err != nil {
continue // skip missing paths
}

View File

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

View File

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