summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2018-03-07 12:36:40 -0600
committerGitHub <noreply@github.com>2018-03-07 12:36:40 -0600
commite8943936c51450540a4f2e8e7a2f3a2af90d14db (patch)
treebc7d32557780a2235a4f9a878d3b0841a1df0bda /cmd
parentfd9ee780ed713c10f122f9eb83e07bfdf09ce4a4 (diff)
downloadchat-e8943936c51450540a4f2e8e7a2f3a2af90d14db.tar.gz
chat-e8943936c51450540a4f2e8e7a2f3a2af90d14db.tar.bz2
chat-e8943936c51450540a4f2e8e7a2f3a2af90d14db.zip
general cleanup (#8387)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/platform/sampledata.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/cmd/platform/sampledata.go b/cmd/platform/sampledata.go
index 98a041d8f..97a73b021 100644
--- a/cmd/platform/sampledata.go
+++ b/cmd/platform/sampledata.go
@@ -312,7 +312,7 @@ func sampleDataCmdF(cmd *cobra.Command, args []string) error {
}
importErr, lineNumber := a.BulkImport(bulkFile, false, workers)
if importErr != nil {
- return errors.New(fmt.Sprintf("%s: %s, %s (line: %d)", importErr.Where, importErr.Message, importErr.DetailedError, lineNumber))
+ return fmt.Errorf("%s: %s, %s (line: %d)", importErr.Where, importErr.Message, importErr.DetailedError, lineNumber)
}
} else if bulk != "-" {
err := bulkFile.Close()
@@ -395,7 +395,7 @@ func createUser(idx int, teamMemberships int, channelMemberships int, teamsAndCh
position := rand.Intn(len(possibleTeams))
team := possibleTeams[position]
possibleTeams = append(possibleTeams[:position], possibleTeams[position+1:]...)
- if teamChannels, err := teamsAndChannels[team]; err == true {
+ if teamChannels, err := teamsAndChannels[team]; err {
teams = append(teams, createTeamMembership(channelMemberships, teamChannels, &team))
}
}
@@ -429,10 +429,7 @@ func createTeamMembership(numOfchannels int, teamChannels []string, teamName *st
roles = "team_user team_admin"
}
channels := []app.UserChannelImportData{}
- teamChannelsCopy := []string{}
- for _, value := range teamChannels {
- teamChannelsCopy = append(teamChannelsCopy, value)
- }
+ teamChannelsCopy := append([]string(nil), teamChannels...)
for x := 0; x < numOfchannels; x++ {
if len(teamChannelsCopy) == 0 {
break