Skip to content

Commit 2fd5889

Browse files
committed
chore: improve variable name
1 parent 4aac08d commit 2fd5889

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

cli/sharing.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ func (r *RootCmd) shareWorkspace(orgContext *OrganizationContext) *serpent.Comma
131131
role := groupAndRole[2]
132132

133133
var orgGroup *codersdk.Group
134-
for _, g := range orgGroups {
135-
if g.Name == groupName {
136-
orgGroup = &g
134+
for _, group := range orgGroups {
135+
if group.Name == groupName {
136+
orgGroup = &group
137137
break
138138
}
139139
}

cli/sharing_test.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,8 @@ func TestSharingShare(t *testing.T) {
116116
Role: codersdk.WorkspaceRoleUse,
117117
})
118118

119-
// Test that the users appear in the output
120-
outputLines := strings.Split(out.String(), "\n")
121-
userNames := []string{toShareWithUser1.Username, toShareWithUser2.Username}
122-
for _, username := range userNames {
123-
index := slices.IndexFunc(outputLines, func(line string) bool {
124-
return strings.Contains(line, username)
125-
})
126-
127-
assert.True(t, index != -1, fmt.Sprintf("Expected to find the username %s in the command output: %s", username, out.String()))
128-
}
119+
assert.Contains(t, out.String(), toShareWithUser1.Username)
120+
assert.Contains(t, out.String(), toShareWithUser2.Username)
129121
})
130122

131123
t.Run("ShareWithUsers_Roles", func(t *testing.T) {

0 commit comments

Comments
 (0)