From 1bf19517eb7d979e705178beba75a3bd8ddb762d Mon Sep 17 00:00:00 2001 From: Rafael Quintela Date: Thu, 18 Aug 2022 12:28:28 -0300 Subject: [PATCH] update & lint --- go.mod | 5 ++--- go.sum | 10 ++++------ pkg/wtc/wtc.go | 7 +++---- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 5c93790..7fdbd8a 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,7 @@ module github.com/rafaelsq/wtc go 1.17 require ( - github.com/creack/pty v1.1.11 + github.com/creack/pty v1.1.18 github.com/radovskyb/watcher v1.0.7 - golang.org/x/sys v0.0.0-20201029080932-201ba4db2418 // indirect - gopkg.in/yaml.v2 v2.2.4 + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 4080bf0..e9b9ff4 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,8 @@ -github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= -github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/radovskyb/watcher v1.0.7 h1:AYePLih6dpmS32vlHfhCeli8127LzkIgwJGcwwe8tUE= github.com/radovskyb/watcher v1.0.7/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg= -golang.org/x/sys v0.0.0-20201029080932-201ba4db2418 h1:HlFl4V6pEMziuLXyRkm5BIYq1y1GAbb02pRlWvI54OM= -golang.org/x/sys v0.0.0-20201029080932-201ba4db2418/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/pkg/wtc/wtc.go b/pkg/wtc/wtc.go index 434dd8e..12f5fda 100644 --- a/pkg/wtc/wtc.go +++ b/pkg/wtc/wtc.go @@ -7,7 +7,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "os" "os/exec" @@ -351,7 +350,7 @@ func Start(cfg *Config) { func findFile() ([]byte, error) { for _, file := range []string{"wtc.yaml", ".wtc.yaml", "wtc.yml", ".wtc.yml"} { if _, err := os.Stat(file); err == nil { - return ioutil.ReadFile(file) + return os.ReadFile(file) } } @@ -362,7 +361,7 @@ func readConfig(config *Config, filePath string) (bool, error) { var yamlFile []byte var err error if len(filePath) != 0 { - yamlFile, err = ioutil.ReadFile(filePath) + yamlFile, err = os.ReadFile(filePath) } else { yamlFile, err = findFile() } @@ -534,7 +533,7 @@ func trig(rule *Rule, pkg, path string) error { envFileLastModifiedLock.Lock() if lastModified, ok := envFileLastModified[e.Name]; !ok || fileInfo.ModTime().Sub(lastModified) > 0 { - b, err := ioutil.ReadFile(e.Name) + b, err := os.ReadFile(e.Name) if err != nil { log.Fatal(err) }