Skip to content

Commit

Permalink
update & lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelsq committed Aug 18, 2022
1 parent 707e464 commit 1bf1951
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
7 changes: 3 additions & 4 deletions pkg/wtc/wtc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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()
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 1bf1951

Please sign in to comment.