From 634d3890a89ece58f6bc6bcb799da3872167071d Mon Sep 17 00:00:00 2001 From: Dag Wullt Date: Sun, 22 Jan 2023 20:28:55 +0100 Subject: [PATCH] Update to go19 --- go.mod | 29 +++++++++++++++++++++++------ go.sum | 2 -- monstache.go | 14 +++++++------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 181b868..51baa6c 100644 --- a/go.mod +++ b/go.mod @@ -6,17 +6,34 @@ require ( github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf github.com/evanphx/json-patch v5.6.0+incompatible github.com/fsnotify/fsnotify v1.5.1 - github.com/golang/snappy v0.0.4 // indirect - github.com/klauspost/compress v1.15.1 // indirect - github.com/kr/pretty v0.2.1 // indirect - github.com/kr/text v0.2.0 // indirect github.com/olivere/elastic/v7 v7.0.31 github.com/robertkrimen/otto v0.0.0-20211024170158-b87d35c0b86f github.com/rwynn/gtm/v2 v2.1.2 go.mongodb.org/mongo-driver v1.11.0 - golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 // indirect gopkg.in/Graylog2/go-gelf.v2 v2.0.0-20191017102106-1550ee647df0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 ) -go 1.13 +require ( + github.com/golang/snappy v0.0.4 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/klauspost/compress v1.15.1 // indirect + github.com/kr/pretty v0.2.1 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/serialx/hashring v0.0.0-20200727003509-22c0c7ab6b1b // indirect + github.com/xdg-go/pbkdf2 v1.0.0 // indirect + github.com/xdg-go/scram v1.1.1 // indirect + github.com/xdg-go/stringprep v1.0.3 // indirect + github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect + golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 // indirect + golang.org/x/text v0.3.7 // indirect + gopkg.in/sourcemap.v1 v1.0.5 // indirect +) + +go 1.19 diff --git a/go.sum b/go.sum index fdb197c..307a1c3 100644 --- a/go.sum +++ b/go.sum @@ -133,7 +133,6 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -193,7 +192,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba gopkg.in/Graylog2/go-gelf.v2 v2.0.0-20191017102106-1550ee647df0 h1:Xg23ydYYJLmb9AK3XdcEpplHZd1MpN3X2ZeeMoBClmY= gopkg.in/Graylog2/go-gelf.v2 v2.0.0-20191017102106-1550ee647df0/go.mod h1:CeDeqW4tj9FrgZXF/dQCWZrBdcZWWBenhJtxLH4On2g= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= diff --git a/monstache.go b/monstache.go index 8f2833f..4b31dca 100644 --- a/monstache.go +++ b/monstache.go @@ -11,7 +11,7 @@ import ( "errors" "flag" "fmt" - "io/ioutil" + "io" "log" "math" "net/http" @@ -1846,7 +1846,7 @@ func (config *configOptions) loadPipelines() { errorLog.Fatalln("Pipelines must specify path or script but not both") } if s.Path != "" { - if script, err := ioutil.ReadFile(s.Path); err == nil { + if script, err := os.ReadFile(s.Path); err == nil { s.Script = string(script[:]) } else { errorLog.Fatalf("Unable to load pipeline at path %s: %s", s.Path, err) @@ -1886,7 +1886,7 @@ func (config *configOptions) loadFilters() { errorLog.Fatalln("Filters must specify path or script but not both") } if s.Path != "" { - if script, err := ioutil.ReadFile(s.Path); err == nil { + if script, err := os.ReadFile(s.Path); err == nil { s.Script = string(script[:]) } else { errorLog.Fatalf("Unable to load filter at path %s: %s", s.Path, err) @@ -1943,7 +1943,7 @@ func (config *configOptions) loadScripts() { errorLog.Fatalln("Scripts must specify path or script but not both") } if s.Path != "" { - if script, err := ioutil.ReadFile(s.Path); err == nil { + if script, err := os.ReadFile(s.Path); err == nil { s.Script = string(script[:]) } else { errorLog.Fatalf("Unable to load script at path %s: %s", s.Path, err) @@ -2045,7 +2045,7 @@ func (config *configOptions) decodeAsTemplate() *configOptions { name, val := pair[0], pair[1] env[name] = val } - tpl, err := ioutil.ReadFile(config.ConfigFile) + tpl, err := os.ReadFile(config.ConfigFile) if err != nil { errorLog.Fatalln(err) } @@ -2643,7 +2643,7 @@ func (config *configOptions) loadVariableValueFromFile(name string, path string) return name, "", fmt.Errorf("read value for %s from file failed: %s", name, err) } defer f.Close() - c, err := ioutil.ReadAll(f) + c, err := io.ReadAll(f) if err != nil { return name, "", fmt.Errorf("read value for %s from file failed: %s", name, err) } @@ -2893,7 +2893,7 @@ func (config *configOptions) NewHTTPClient() (client *http.Client, err error) { if config.ElasticPemFile != "" { var ca []byte certs := x509.NewCertPool() - if ca, err = ioutil.ReadFile(config.ElasticPemFile); err == nil { + if ca, err = os.ReadFile(config.ElasticPemFile); err == nil { if ok := certs.AppendCertsFromPEM(ca); !ok { errorLog.Printf("No certs parsed successfully from %s", config.ElasticPemFile) }