3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 11:59:40 +01:00

Merge pull request #1543 from oragono/goupgrade

upgrade go to 1.16
This commit is contained in:
Shivaram Lingamneni 2021-02-17 15:18:50 -05:00 committed by GitHub
commit 7814694d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 21 deletions

View File

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

View File

@ -1,5 +1,5 @@
## build Oragono ## 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 RUN apk add --no-cache git make curl sed

2
go.mod
View File

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

View File

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

View File

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

View File

@ -6,8 +6,8 @@ package irc
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil"
"log" "log"
"os"
"strconv" "strconv"
"github.com/tidwall/buntdb" "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) { func ImportDB(config *Config, infile string) (err error) {
data, err := ioutil.ReadFile(infile) data, err := os.ReadFile(infile)
if err != nil { if err != nil {
return return
} }

View File

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

View File

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

View File

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

View File

@ -6,7 +6,6 @@ package utils
import ( import (
"crypto/tls" "crypto/tls"
"encoding/binary" "encoding/binary"
"errors"
"io" "io"
"net" "net"
"strings" "strings"
@ -39,8 +38,6 @@ func (p *proxyLineError) Temporary() bool {
var ( var (
ErrBadProxyLine error = &proxyLineError{} 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 // 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 { if err == nil {
conn.Close() conn.Close()
} }
err = ErrNetClosing err = net.ErrClosed
} }
if err != nil { if err != nil {
return nil, err return nil, err