diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c9f27a..fa47d0b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,4 +13,30 @@ permissions: jobs: call-workflow: - uses: antham/go-workflow-github-action/.github/workflows/build-library.yml@master + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Build + run: | + go build + + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest + + - name: Test + run: | + go test -race -cover -coverprofile=coverage.txt ./... + + - name: Push on codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/go.mod b/go.mod index 2d74a0c..d81dc4f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/antham/strumt/v2 -require github.com/stretchr/testify v1.8.2 +go 1.24 + +require github.com/stretchr/testify v1.11.1 require ( github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/go.sum b/go.sum index 6a56e69..c4c1710 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,10 @@ -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/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/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= 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.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/prompt_example_multiline_test.go b/prompt_example_multiline_test.go index 4895d31..48efaf5 100644 --- a/prompt_example_multiline_test.go +++ b/prompt_example_multiline_test.go @@ -3,7 +3,7 @@ package strumt_test import ( "bytes" "fmt" - "io/ioutil" + "io" "github.com/antham/strumt/v2" ) @@ -12,7 +12,7 @@ func Example_multilinePrompt() { var datas []string buf := "test1\ntest2\ntest3\ntest4\n\n" - p := strumt.NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), ioutil.Discard) + p := strumt.NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), io.Discard) p.AddMultilinePrompter(&SlicePrompt{&datas}) p.SetFirst("sliceprompt") p.Run() diff --git a/prompts_example_test.go b/prompts_example_test.go index d6bf11e..b318b3e 100644 --- a/prompts_example_test.go +++ b/prompts_example_test.go @@ -3,7 +3,7 @@ package strumt_test import ( "bytes" "fmt" - "io/ioutil" + "io" "strconv" "github.com/antham/strumt/v2" @@ -14,7 +14,7 @@ func Example() { buf := "\nBrad\n\nBlanton\nwhatever\n0\n31\n" - p := strumt.NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), ioutil.Discard) + p := strumt.NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), io.Discard) p.AddLinePrompter(&StringPrompt{&user.FirstName, "Enter your first name", "userName", "lastName", "userName"}) p.AddLinePrompter(&StringPrompt{&user.LastName, "Enter your last name", "lastName", "age", "lastName"}) p.AddLinePrompter(&IntPrompt{&user.Age, "Enter your age", "age", "", "age"}) diff --git a/prompts_test.go b/prompts_test.go index d9c9743..cb132b8 100644 --- a/prompts_test.go +++ b/prompts_test.go @@ -5,7 +5,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "net" "os" "strconv" @@ -291,7 +290,7 @@ func TestPromptRunWithCustomRenderer(t *testing.T) { func TestPromptsScenario(t *testing.T) { buf := "\nuser\n\npassword\ntest\n10000\n127.0.0.1\ntest\n1.2.3.4\n8.9.10.11\n\n127.0.0.1\n1.2.3.4\n8.9.10.11\n\nlocalhost:127.0.0.1\ntest\nmyIp:1.2.3.4\n\nlocalhost:127.0.0.1\nmyIp:1.2.3.4\n\n" - p := NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), ioutil.Discard) + p := NewPromptsFromReaderAndWriter(bytes.NewBufferString(buf), io.Discard) p.AddLinePrompter(&StringPrompt{new(string), "Give a username", "username", "password", "username"}) p.AddLinePrompter(&StringPrompt{new(string), "Give a password", "password", "port", "password"})