diff --git a/.travis.yml b/.travis.yml index 085fbad6..04e08788 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: go dist: focal go: - - "1.15.x" + - "1.16.x" branches: only: diff --git a/Dockerfile b/Dockerfile index a89dbaa3..9f0e8f22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/go.mod b/go.mod index c25ae525..251b88f3 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/irc/config.go b/irc/config.go index 873e55ff..94c882d9 100644 --- a/irc/config.go +++ b/irc/config.go @@ -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 } diff --git a/irc/email/dkim.go b/irc/email/dkim.go index 538ffee6..10952478 100644 --- a/irc/email/dkim.go +++ b/irc/email/dkim.go @@ -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 } diff --git a/irc/import.go b/irc/import.go index 95894fdc..55e855ba 100644 --- a/irc/import.go +++ b/irc/import.go @@ -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 } diff --git a/irc/jwt/extjwt.go b/irc/jwt/extjwt.go index 803f83e5..f754e7d5 100644 --- a/irc/jwt/extjwt.go +++ b/irc/jwt/extjwt.go @@ -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 } diff --git a/irc/languages/languages.go b/irc/languages/languages.go index ee7f2591..7fcb257f 100644 --- a/irc/languages/languages.go +++ b/irc/languages/languages.go @@ -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 } diff --git a/irc/listeners.go b/irc/listeners.go index c50138f8..740a0466 100644 --- a/irc/listeners.go +++ b/irc/listeners.go @@ -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()) diff --git a/irc/utils/proxy.go b/irc/utils/proxy.go index 584e3f34..22a48264 100644 --- a/irc/utils/proxy.go +++ b/irc/utils/proxy.go @@ -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