Skip to content

Commit 7a85975

Browse files
ammariopull[bot]
authored andcommitted
ci: lint against dupl (#9357)
This lint rule should help us keep Go code redundancy under control.
1 parent 2e260a3 commit 7a85975

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

.golangci.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# Over time we should try tightening some of these.
33

44
linters-settings:
5+
dupl:
6+
# goal: 100
7+
threshold: 412
8+
59
exhaustruct:
610
include:
711
# Gradually extend to cover more of the codebase.
@@ -268,3 +272,4 @@ linters:
268272
- typecheck
269273
- unconvert
270274
- unused
275+
- dupl

cli/update_test.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -602,13 +602,9 @@ func TestUpdateValidateRichParameters(t *testing.T) {
602602
// Update the workspace
603603
inv, root = clitest.New(t, "update", "my-workspace")
604604
clitest.SetupConfig(t, client, root)
605-
doneChan := make(chan struct{})
605+
606606
pty := ptytest.New(t).Attach(inv)
607-
go func() {
608-
defer close(doneChan)
609-
err := inv.Run()
610-
assert.NoError(t, err)
611-
}()
607+
clitest.Start(t, inv)
612608

613609
matches := []string{
614610
stringParameterName, "second_option",
@@ -623,7 +619,6 @@ func TestUpdateValidateRichParameters(t *testing.T) {
623619
pty.WriteLine(value)
624620
}
625621
}
626-
<-doneChan
627622
})
628623

629624
t.Run("ParameterOptionDisappeared", func(t *testing.T) {
@@ -668,13 +663,8 @@ func TestUpdateValidateRichParameters(t *testing.T) {
668663
// Update the workspace
669664
inv, root = clitest.New(t, "update", "my-workspace")
670665
clitest.SetupConfig(t, client, root)
671-
doneChan := make(chan struct{})
672666
pty := ptytest.New(t).Attach(inv)
673-
go func() {
674-
defer close(doneChan)
675-
err := inv.Run()
676-
assert.NoError(t, err)
677-
}()
667+
clitest.Start(t, inv)
678668

679669
matches := []string{
680670
stringParameterName, "Third option",
@@ -689,7 +679,6 @@ func TestUpdateValidateRichParameters(t *testing.T) {
689679
pty.WriteLine(value)
690680
}
691681
}
692-
<-doneChan
693682
})
694683

695684
t.Run("ImmutableRequiredParameterExists_MutableRequiredParameterAdded", func(t *testing.T) {

0 commit comments

Comments
 (0)