diff --git a/.github/workflows/gfmrun.yml b/.github/workflows/gfmrun.yml index dbd2488..e96cb90 100644 --- a/.github/workflows/gfmrun.yml +++ b/.github/workflows/gfmrun.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Setup Python uses: actions/setup-python@v3 @@ -39,7 +39,7 @@ jobs: - name: Run Linter uses: golangci/golangci-lint-action@v3 with: - version: v1.45.2 + version: v1.50.0 - name: Run Test Suite run: make all diff --git a/go.mod b/go.mod index ccf151a..ec1cb0b 100644 --- a/go.mod +++ b/go.mod @@ -3,16 +3,18 @@ module github.com/urfave/gfmrun go 1.18 require ( - github.com/sirupsen/logrus v1.8.1 - github.com/stretchr/testify v1.2.2 - github.com/urfave/cli/v2 v2.5.1 + github.com/sirupsen/logrus v1.9.0 + github.com/stretchr/testify v1.8.0 + github.com/urfave/cli/v2 v2.19.2 gopkg.in/yaml.v2 v2.4.0 ) require ( - github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect + golang.org/x/sys v0.0.0-20221006211917-84dc82d7e875 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 54fe82c..980ded4 100644 --- a/go.sum +++ b/go.sum @@ -1,27 +1,31 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/urfave/cli/v2 v2.4.0 h1:m2pxjjDFgDxSPtO8WSdbndj17Wu2y8vOT86wE/tjr+I= -github.com/urfave/cli/v2 v2.4.0/go.mod h1:NX9W0zmTvedE5oDoOMs2RTC8RvdK98NTYZE5LbaEYPg= -github.com/urfave/cli/v2 v2.5.1 h1:YKwdkyA0xTBzOaP2G0DVxBnCheHGP+Y9VbKAs4K1Ess= -github.com/urfave/cli/v2 v2.5.1/go.mod h1:oDzoM7pVwz6wHn5ogWgFUU1s4VJayeQS+aEZDqXIEJs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32 h1:Js08h5hqB5xyWR789+QqueR6sDE8mk+YvpETZ+F6X9Y= -golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/urfave/cli/v2 v2.19.2 h1:eXu5089gqqiDQKSnFW+H/FhjrxRGztwSxlTsVK7IuqQ= +github.com/urfave/cli/v2 v2.19.2/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20221006211917-84dc82d7e875 h1:AzgQNqF+FKwyQ5LbVrVqOcuuFB67N47F9+htZYH0wFM= +golang.org/x/sys v0.0.0-20221006211917-84dc82d7e875/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.8/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= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/languages.go b/languages.go index 5a494e4..aaed4e3 100644 --- a/languages.go +++ b/languages.go @@ -3,7 +3,6 @@ package gfmrun import ( "fmt" "io" - "io/ioutil" "net/http" "os" "path/filepath" @@ -110,7 +109,7 @@ func LoadLanguages(languagesYml string) (*Languages, error) { languagesYml = DefaultLanguagesYml } - rawBytes, err := ioutil.ReadFile(languagesYml) + rawBytes, err := os.ReadFile(languagesYml) if err != nil { return nil, err } @@ -153,12 +152,12 @@ func PullLanguagesYml(srcURL, destFile string) error { return fmt.Errorf("fetching %q returned status %v", srcURL, resp.StatusCode) } - respBodyBytes, err := ioutil.ReadAll(resp.Body) + respBodyBytes, err := io.ReadAll(resp.Body) if err != nil { return err } - outTmp, err := ioutil.TempFile("", "gfmrun-linguist") + outTmp, err := os.CreateTemp("", "gfmrun-linguist") if err != nil { _ = outTmp.Close() return err @@ -168,7 +167,7 @@ func PullLanguagesYml(srcURL, destFile string) error { defer func() { _ = os.Remove(outTmp.Name()) }() - err = ioutil.WriteFile(outTmp.Name(), respBodyBytes, os.FileMode(0640)) + err = os.WriteFile(outTmp.Name(), respBodyBytes, os.FileMode(0640)) if err != nil { return err } diff --git a/languages_test.go b/languages_test.go index 17cad9c..1326cfa 100644 --- a/languages_test.go +++ b/languages_test.go @@ -1,7 +1,6 @@ package gfmrun import ( - "io/ioutil" "os" "testing" @@ -60,7 +59,7 @@ func TestLanguagesIntegration(t *testing.T) { t.Skip("integration tests disabled") } - tf, err := ioutil.TempFile("", "gfmrun-test") + tf, err := os.CreateTemp("", "gfmrun-test") assert.Nil(t, err) tf.Close() diff --git a/package_test.go b/package_test.go index 4197a0d..cb51ca0 100644 --- a/package_test.go +++ b/package_test.go @@ -1,7 +1,7 @@ package gfmrun import ( - "io/ioutil" + "io" "os" "github.com/sirupsen/logrus" @@ -14,5 +14,5 @@ var ( func init() { testLog.Level = logrus.PanicLevel - testLog.Out = ioutil.Discard + testLog.Out = io.Discard } diff --git a/runnable.go b/runnable.go index 088789e..5ca31e1 100644 --- a/runnable.go +++ b/runnable.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "html" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -187,7 +186,7 @@ func (rn *Runnable) Extract(i int, dir string) *runResult { "filename": outFileName, }).Info("extracting example") - err := ioutil.WriteFile(outFileName, []byte(rn.String()), os.FileMode(0600)) + err := os.WriteFile(outFileName, []byte(rn.String()), os.FileMode(0600)) if err != nil { return &runResult{Runnable: rn, Retcode: -1, Error: err} } @@ -217,7 +216,7 @@ func (rn *Runnable) Run(i int) *runResult { return &runResult{Runnable: rn, Retcode: -1, Error: err} } - tmpDir, err := ioutil.TempDir(baseTmp, "tmp.*") + tmpDir, err := os.MkdirTemp(baseTmp, "tmp.*") if err != nil { return &runResult{Runnable: rn, Retcode: -1, Error: err} } diff --git a/runner.go b/runner.go index 9df8bf5..43672fb 100644 --- a/runner.go +++ b/runner.go @@ -2,7 +2,6 @@ package gfmrun import ( "fmt" - "io/ioutil" "os" "time" @@ -76,7 +75,7 @@ func (r *Runner) Run() []error { sourcesStart := time.Now() for i, sourceFile := range r.Sources { - sourceBytes, err := ioutil.ReadFile(sourceFile) + sourceBytes, err := os.ReadFile(sourceFile) if err != nil { res = append(res, &runResult{Retcode: -1, Error: err}) continue