Skip to content

Commit

Permalink
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 (#28)
Browse files Browse the repository at this point in the history
* Bump github.com/stretchr/testify from 1.8.2 to 1.8.3

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.2 to 1.8.3.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.8.2...v1.8.3)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix broken tests

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: nhatthm <thmnhat@gmail.com>
  • Loading branch information
dependabot[bot] and nhatthm committed May 22, 2023
1 parent 826a085 commit 7ce0548
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 81 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- id: get-lint-version
- id: vars
run: |
make golangci-lint-version
make $GITHUB_OUTPUT
- name: lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: ${{ steps.get-lint-version.outputs.GOLANGCI_LINT_VERSION }}
version: ${{ steps.vars.outputs.GOLANGCI_LINT_VERSION }}

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
go-version: [ 1.17.x, 1.18.x, 1.19.x ]
go-version: [ 1.17.x, 1.18.x, 1.19.x, 1.20.x ]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/update-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,30 @@ name: 'update-registry'

on:
push:
branches:
- master
tags:
- v*
workflow_dispatch:

env:
MODULE_NAME: surveyexpect

jobs:
notify:
runs-on: ubuntu-latest
strategy:
matrix:
registry: [ go.nhat.io, go-staging.nhat.io ]
steps:
- uses: actions/checkout@v3

- id: vars
run: |
make $GITHUB_OUTPUT
- name: notify ${{ matrix.registry }}
uses: benc-uk/workflow-dispatch@v121
with:
workflow: build
repo: nhatthm/${{ matrix.registry }}
token: ${{ secrets.REGISTRY_TOKEN }}
inputs: '{"modules": "${{ env.MODULE_NAME }}"}'
inputs: '{"modules": "${{ steps.vars.outputs.MODULE_NAME }}"}'
ref: 'master'
5 changes: 4 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ linters-settings:
linters:
enable-all: true
disable:
- deadcode
- exhaustivestruct
- exhaustruct
- forbidigo
Expand All @@ -33,11 +34,13 @@ linters:
- ireturn
- lll
- maligned
- nolintlint # https://github.com/golangci/golangci-lint/issues/3063
- nosnakecase
- paralleltest
- scopelint
- structcheck
- tagliatelle
- testpackage
- varcheck
- varnamelen
- wrapcheck

Expand Down
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
MODULE_NAME=surveyexpect

VENDOR_DIR = vendor

GOLANGCI_LINT_VERSION ?= v1.48.0
GOLANGCI_LINT_VERSION ?= v1.52.2

GO ?= go
GOLANGCI_LINT ?= $(shell go env GOPATH)/bin/golangci-lint-$(GOLANGCI_LINT_VERSION)

GITHUB_OUTPUT ?= /dev/null

.PHONY: $(VENDOR_DIR)
$(VENDOR_DIR):
@mkdir -p $(VENDOR_DIR)
Expand All @@ -23,9 +27,10 @@ test-unit:
@echo ">> unit test"
@$(GO) test -gcflags=-l -coverprofile=unit.coverprofile -covermode=atomic -race ./...

.PHONY: golangci-lint-version
golangci-lint-version:
@echo "::set-output name=GOLANGCI_LINT_VERSION::$(GOLANGCI_LINT_VERSION)"
.PHONY: $(GITHUB_OUTPUT)
$(GITHUB_OUTPUT):
@echo "MODULE_NAME=$(MODULE_NAME)" >> "$@"
@echo "GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION)" >> "$@"

$(GOLANGCI_LINT):
@echo "$(OK_COLOR)==> Installing golangci-lint $(GOLANGCI_LINT_VERSION)$(NO_COLOR)"; \
Expand Down
18 changes: 6 additions & 12 deletions answer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ type Answer interface {
type NoAnswer struct{}

// Do runs the step.
// nolint: errcheck,gosec
func (a *NoAnswer) Do(c Console) error {
c.SendLine("")
c.SendLine("") //nolint: errcheck,gosec

return nil
}
Expand All @@ -44,9 +43,8 @@ func noAnswer() *NoAnswer {
type InterruptAnswer struct{}

// Do runs the step.
// nolint: errcheck,gosec
func (a *InterruptAnswer) Do(c Console) error {
c.SendLine(string(terminal.KeyInterrupt))
c.SendLine(string(terminal.KeyInterrupt)) //nolint: errcheck,gosec

return terminal.InterruptErr
}
Expand All @@ -67,9 +65,8 @@ type HelpAnswer struct {
}

// Do runs the step.
// nolint: errcheck,gosec
func (a *HelpAnswer) Do(c Console) error {
c.SendLine(a.icon)
c.SendLine(a.icon) //nolint: errcheck,gosec

if _, err := c.ExpectString(a.help); err != nil {
return err
Expand Down Expand Up @@ -101,9 +98,8 @@ type Action struct {
}

// Do runs the step.
// nolint: errcheck,gosec
func (a *Action) Do(c Console) error {
c.Send(string(a.code))
c.Send(string(a.code)) //nolint: errcheck,gosec

return nil
}
Expand Down Expand Up @@ -167,9 +163,8 @@ type HelpAction struct {
}

// Do runs the step.
// nolint: errcheck,gosec
func (a *HelpAction) Do(c Console) error {
c.Send(a.icon)
c.Send(a.icon) //nolint: errcheck,gosec

if _, err := c.ExpectString(a.help); err != nil {
return err
Expand Down Expand Up @@ -200,9 +195,8 @@ type TypeAnswer struct {
}

// Do runs the step.
// nolint: errcheck,gosec
func (a *TypeAnswer) Do(c Console) error {
c.Send(a.answer)
c.Send(a.answer) //nolint: errcheck,gosec

return nil
}
Expand Down
6 changes: 3 additions & 3 deletions confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (c *ConfirmPrompt) No() {

// Answer sets a custom answer to the prompt.
//
// If the answer is not not empty, the survey expects to have a feedback from the prompt:
// If the answer is not empty, the survey expects to have a feedback from the prompt:
//
// `Sorry, your reply was invalid: "hello world!" is not a valid answer, please try again.`
//
Expand All @@ -93,7 +93,7 @@ func (c *ConfirmPrompt) Do(console Console) error {
return err
}

_ = waitForCursorTwice(console) // nolint: errcheck
_ = waitForCursorTwice(console) //nolint: errcheck

err := c.answer.Do(console)
if err != nil && !IsInterrupted(err) {
Expand Down Expand Up @@ -144,7 +144,7 @@ func (a *ConfirmAnswer) Interrupted() {
}

// Do runs the step.
// nolint: errcheck,gosec
// nolint: errcheck,gosec,nolintlint
func (a *ConfirmAnswer) Do(c Console) error {
if a.interrupted {
c.Send(a.answer)
Expand Down
8 changes: 4 additions & 4 deletions cursor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func TestWaitForCursor(t *testing.T) {
console, err := expect.NewConsole(expect.WithStdin(pty), expect.WithStdout(term), expect.WithCloser(pty, tty))
require.NoError(t, err)

_ = console.Close() // nolint: errcheck
_ = tty.Close() // nolint: errcheck
_ = console.Close() //nolint: errcheck
_ = tty.Close() //nolint: errcheck

err = waitForCursor(console)
require.Error(t, err)
Expand All @@ -38,8 +38,8 @@ func TestWaitForCursorTwice(t *testing.T) {
console, err := expect.NewConsole(expect.WithStdin(pty), expect.WithStdout(term), expect.WithCloser(pty, tty))
require.NoError(t, err)

_ = console.Close() // nolint: errcheck
_ = tty.Close() // nolint: errcheck
_ = console.Close() //nolint: errcheck
_ = tty.Close() //nolint: errcheck

err = waitForCursorTwice(console)
require.Error(t, err)
Expand Down
3 changes: 1 addition & 2 deletions expect.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ func Expect(options ...ExpectOption) Expector {
}
}

// nolint: gochecknoinits
func init() {
func init() { //nolint: gochecknoinits
// Disable color output for all prompts to simplify testing.
core.DisableColor = true
}
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ require (
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2
github.com/creack/pty v1.1.18
github.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.3
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
25 changes: 11 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,31 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
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.6.1/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/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.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 h1:UiNENfZ8gDvpiWw7IpOMQ27spWmThO1RwwdQVbJahJM=
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
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=
Expand Down
2 changes: 1 addition & 1 deletion input.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ type InputAnswer struct {
}

// Do runs the step.
// nolint: errcheck,gosec
// nolint: errcheck,gosec,nolintlint
func (a *InputAnswer) Do(c Console) error {
if a.interrupted {
c.Send(a.answer)
Expand Down
17 changes: 0 additions & 17 deletions main/main.go

This file was deleted.

4 changes: 2 additions & 2 deletions multiline.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (p *MultilinePrompt) Do(c Console) error {
return err
}

_ = waitForCursorTwice(c) // nolint: errcheck
_ = waitForCursorTwice(c) //nolint: errcheck

err := p.answer.Do(c)
if err != nil && !IsInterrupted(err) {
Expand Down Expand Up @@ -118,7 +118,7 @@ type MultilineAnswer struct {
}

// Do runs the step.
// nolint: errcheck,gosec
// nolint: errcheck,gosec,nolintlint
func (a *MultilineAnswer) Do(c Console) error {
if a.interrupted {
c.Send(a.answer)
Expand Down
4 changes: 2 additions & 2 deletions password.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (p *PasswordPrompt) Do(c Console) error {
return err
}

_ = waitForCursorTwice(c) // nolint: errcheck
_ = waitForCursorTwice(c) //nolint: errcheck

err := p.answer.Do(c)
if err != nil && !IsInterrupted(err) {
Expand Down Expand Up @@ -129,7 +129,7 @@ type PasswordAnswer struct {
}

// Do runs the step.
// nolint: errcheck,gosec
// nolint: errcheck,gosec,nolintlint
func (a *PasswordAnswer) Do(c Console) error {
if a.interrupted {
c.Send(a.answer)
Expand Down
5 changes: 2 additions & 3 deletions step.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ func (s *Steps) Close() {
}

// Append appends an expectation to the sequence.
// nolint: unparam
func (s *Steps) Append(more ...Step) *Steps {
func (s *Steps) Append(more ...Step) *Steps { //nolint: unparam
s.lock()
defer s.unlock()

Expand Down Expand Up @@ -154,7 +153,7 @@ func (s *Steps) ExpectationsWereMet() error {
return nil
}

// nolint:goerr113
//nolint:goerr113
return errors.New(s.String())
}

Expand Down
Loading

0 comments on commit 7ce0548

Please sign in to comment.