Skip to content

Commit 7ce0548

Browse files
Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 (#28)
* 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] <[email protected]> * Fix broken tests --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: nhatthm <[email protected]>
1 parent 826a085 commit 7ce0548

18 files changed

+66
-81
lines changed

.github/workflows/lint.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ jobs:
1818
with:
1919
go-version: ${{ env.GO_VERSION }}
2020

21-
- id: get-lint-version
21+
- id: vars
2222
run: |
23-
make golangci-lint-version
23+
make $GITHUB_OUTPUT
2424
2525
- name: lint
2626
uses: golangci/golangci-lint-action@v3
2727
with:
2828
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
29-
version: ${{ steps.get-lint-version.outputs.GOLANGCI_LINT_VERSION }}
29+
version: ${{ steps.vars.outputs.GOLANGCI_LINT_VERSION }}
3030

3131
# Optional: working directory, useful for monorepos
3232
# working-directory: somedir

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
os: [ ubuntu-latest, macos-latest ]
19-
go-version: [ 1.17.x, 1.18.x, 1.19.x ]
19+
go-version: [ 1.17.x, 1.18.x, 1.19.x, 1.20.x ]
2020
runs-on: ${{ matrix.os }}
2121
steps:
2222
- name: Install Go

.github/workflows/update-registry.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,30 @@ name: 'update-registry'
33

44
on:
55
push:
6+
branches:
7+
- master
68
tags:
79
- v*
810
workflow_dispatch:
911

10-
env:
11-
MODULE_NAME: surveyexpect
12-
1312
jobs:
1413
notify:
1514
runs-on: ubuntu-latest
1615
strategy:
1716
matrix:
1817
registry: [ go.nhat.io, go-staging.nhat.io ]
1918
steps:
19+
- uses: actions/checkout@v3
20+
21+
- id: vars
22+
run: |
23+
make $GITHUB_OUTPUT
24+
2025
- name: notify ${{ matrix.registry }}
2126
uses: benc-uk/workflow-dispatch@v121
2227
with:
2328
workflow: build
2429
repo: nhatthm/${{ matrix.registry }}
2530
token: ${{ secrets.REGISTRY_TOKEN }}
26-
inputs: '{"modules": "${{ env.MODULE_NAME }}"}'
31+
inputs: '{"modules": "${{ steps.vars.outputs.MODULE_NAME }}"}'
2732
ref: 'master'

.golangci.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ linters-settings:
2020
linters:
2121
enable-all: true
2222
disable:
23+
- deadcode
2324
- exhaustivestruct
2425
- exhaustruct
2526
- forbidigo
@@ -33,11 +34,13 @@ linters:
3334
- ireturn
3435
- lll
3536
- maligned
36-
- nolintlint # https://github.com/golangci/golangci-lint/issues/3063
37+
- nosnakecase
3738
- paralleltest
3839
- scopelint
40+
- structcheck
3941
- tagliatelle
4042
- testpackage
43+
- varcheck
4144
- varnamelen
4245
- wrapcheck
4346

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
MODULE_NAME=surveyexpect
2+
13
VENDOR_DIR = vendor
24

3-
GOLANGCI_LINT_VERSION ?= v1.48.0
5+
GOLANGCI_LINT_VERSION ?= v1.52.2
46

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

10+
GITHUB_OUTPUT ?= /dev/null
11+
812
.PHONY: $(VENDOR_DIR)
913
$(VENDOR_DIR):
1014
@mkdir -p $(VENDOR_DIR)
@@ -23,9 +27,10 @@ test-unit:
2327
@echo ">> unit test"
2428
@$(GO) test -gcflags=-l -coverprofile=unit.coverprofile -covermode=atomic -race ./...
2529

26-
.PHONY: golangci-lint-version
27-
golangci-lint-version:
28-
@echo "::set-output name=GOLANGCI_LINT_VERSION::$(GOLANGCI_LINT_VERSION)"
30+
.PHONY: $(GITHUB_OUTPUT)
31+
$(GITHUB_OUTPUT):
32+
@echo "MODULE_NAME=$(MODULE_NAME)" >> "$@"
33+
@echo "GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION)" >> "$@"
2934

3035
$(GOLANGCI_LINT):
3136
@echo "$(OK_COLOR)==> Installing golangci-lint $(GOLANGCI_LINT_VERSION)$(NO_COLOR)"; \

answer.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ type Answer interface {
2424
type NoAnswer struct{}
2525

2626
// Do runs the step.
27-
// nolint: errcheck,gosec
2827
func (a *NoAnswer) Do(c Console) error {
29-
c.SendLine("")
28+
c.SendLine("") //nolint: errcheck,gosec
3029

3130
return nil
3231
}
@@ -44,9 +43,8 @@ func noAnswer() *NoAnswer {
4443
type InterruptAnswer struct{}
4544

4645
// Do runs the step.
47-
// nolint: errcheck,gosec
4846
func (a *InterruptAnswer) Do(c Console) error {
49-
c.SendLine(string(terminal.KeyInterrupt))
47+
c.SendLine(string(terminal.KeyInterrupt)) //nolint: errcheck,gosec
5048

5149
return terminal.InterruptErr
5250
}
@@ -67,9 +65,8 @@ type HelpAnswer struct {
6765
}
6866

6967
// Do runs the step.
70-
// nolint: errcheck,gosec
7168
func (a *HelpAnswer) Do(c Console) error {
72-
c.SendLine(a.icon)
69+
c.SendLine(a.icon) //nolint: errcheck,gosec
7370

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

103100
// Do runs the step.
104-
// nolint: errcheck,gosec
105101
func (a *Action) Do(c Console) error {
106-
c.Send(string(a.code))
102+
c.Send(string(a.code)) //nolint: errcheck,gosec
107103

108104
return nil
109105
}
@@ -167,9 +163,8 @@ type HelpAction struct {
167163
}
168164

169165
// Do runs the step.
170-
// nolint: errcheck,gosec
171166
func (a *HelpAction) Do(c Console) error {
172-
c.Send(a.icon)
167+
c.Send(a.icon) //nolint: errcheck,gosec
173168

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

202197
// Do runs the step.
203-
// nolint: errcheck,gosec
204198
func (a *TypeAnswer) Do(c Console) error {
205-
c.Send(a.answer)
199+
c.Send(a.answer) //nolint: errcheck,gosec
206200

207201
return nil
208202
}

confirm.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (c *ConfirmPrompt) No() {
6666

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

96-
_ = waitForCursorTwice(console) // nolint: errcheck
96+
_ = waitForCursorTwice(console) //nolint: errcheck
9797

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

146146
// Do runs the step.
147-
// nolint: errcheck,gosec
147+
// nolint: errcheck,gosec,nolintlint
148148
func (a *ConfirmAnswer) Do(c Console) error {
149149
if a.interrupted {
150150
c.Send(a.answer)

cursor_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ func TestWaitForCursor(t *testing.T) {
2020
console, err := expect.NewConsole(expect.WithStdin(pty), expect.WithStdout(term), expect.WithCloser(pty, tty))
2121
require.NoError(t, err)
2222

23-
_ = console.Close() // nolint: errcheck
24-
_ = tty.Close() // nolint: errcheck
23+
_ = console.Close() //nolint: errcheck
24+
_ = tty.Close() //nolint: errcheck
2525

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

41-
_ = console.Close() // nolint: errcheck
42-
_ = tty.Close() // nolint: errcheck
41+
_ = console.Close() //nolint: errcheck
42+
_ = tty.Close() //nolint: errcheck
4343

4444
err = waitForCursorTwice(console)
4545
require.Error(t, err)

expect.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ func Expect(options ...ExpectOption) Expector {
5050
}
5151
}
5252

53-
// nolint: gochecknoinits
54-
func init() {
53+
func init() { //nolint: gochecknoinits
5554
// Disable color output for all prompts to simplify testing.
5655
core.DisableColor = true
5756
}

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ require (
77
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2
88
github.com/creack/pty v1.1.18
99
github.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02
10-
github.com/stretchr/testify v1.8.2
10+
github.com/stretchr/testify v1.8.3
1111
)
1212

1313
require (
1414
github.com/davecgh/go-spew v1.1.1 // indirect
1515
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
1616
github.com/mattn/go-colorable v0.1.13 // indirect
17-
github.com/mattn/go-isatty v0.0.16 // indirect
17+
github.com/mattn/go-isatty v0.0.19 // indirect
1818
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
1919
github.com/pmezard/go-difflib v1.0.0 // indirect
20-
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 // indirect
21-
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
22-
golang.org/x/text v0.3.7 // indirect
20+
golang.org/x/sys v0.8.0 // indirect
21+
golang.org/x/term v0.8.0 // indirect
22+
golang.org/x/text v0.9.0 // indirect
2323
gopkg.in/yaml.v3 v3.0.1 // indirect
2424
)

go.sum

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,31 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc
1717
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
1818
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
1919
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
20-
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
2120
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
21+
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
22+
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
2223
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
2324
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
2425
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
2526
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2627
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2728
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
28-
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
29-
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
3029
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
31-
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
32-
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
33-
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
34-
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
30+
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
31+
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
3532
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
3633
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
37-
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3834
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3935
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
40-
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 h1:UiNENfZ8gDvpiWw7IpOMQ27spWmThO1RwwdQVbJahJM=
41-
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
36+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
37+
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
38+
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4239
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
43-
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc=
44-
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
40+
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
41+
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
4542
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
46-
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
47-
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
43+
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
44+
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
4845
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
4946
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
5047
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

input.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ type InputAnswer struct {
161161
}
162162

163163
// Do runs the step.
164-
// nolint: errcheck,gosec
164+
// nolint: errcheck,gosec,nolintlint
165165
func (a *InputAnswer) Do(c Console) error {
166166
if a.interrupted {
167167
c.Send(a.answer)

main/main.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

multiline.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (p *MultilinePrompt) Do(c Console) error {
5050
return err
5151
}
5252

53-
_ = waitForCursorTwice(c) // nolint: errcheck
53+
_ = waitForCursorTwice(c) //nolint: errcheck
5454

5555
err := p.answer.Do(c)
5656
if err != nil && !IsInterrupted(err) {
@@ -118,7 +118,7 @@ type MultilineAnswer struct {
118118
}
119119

120120
// Do runs the step.
121-
// nolint: errcheck,gosec
121+
// nolint: errcheck,gosec,nolintlint
122122
func (a *MultilineAnswer) Do(c Console) error {
123123
if a.interrupted {
124124
c.Send(a.answer)

password.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (p *PasswordPrompt) Do(c Console) error {
6161
return err
6262
}
6363

64-
_ = waitForCursorTwice(c) // nolint: errcheck
64+
_ = waitForCursorTwice(c) //nolint: errcheck
6565

6666
err := p.answer.Do(c)
6767
if err != nil && !IsInterrupted(err) {
@@ -129,7 +129,7 @@ type PasswordAnswer struct {
129129
}
130130

131131
// Do runs the step.
132-
// nolint: errcheck,gosec
132+
// nolint: errcheck,gosec,nolintlint
133133
func (a *PasswordAnswer) Do(c Console) error {
134134
if a.interrupted {
135135
c.Send(a.answer)

step.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ func (s *Steps) Close() {
4444
}
4545

4646
// Append appends an expectation to the sequence.
47-
// nolint: unparam
48-
func (s *Steps) Append(more ...Step) *Steps {
47+
func (s *Steps) Append(more ...Step) *Steps { //nolint: unparam
4948
s.lock()
5049
defer s.unlock()
5150

@@ -154,7 +153,7 @@ func (s *Steps) ExpectationsWereMet() error {
154153
return nil
155154
}
156155

157-
// nolint:goerr113
156+
//nolint:goerr113
158157
return errors.New(s.String())
159158
}
160159

0 commit comments

Comments
 (0)