From 089952e01734c63a1d22d3598d68541d399afe13 Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Sun, 12 May 2024 17:07:12 +0800 Subject: [PATCH] Use range iterator for users list view --- view/users/list.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/view/users/list.go b/view/users/list.go index 561935c..63acd49 100644 --- a/view/users/list.go +++ b/view/users/list.go @@ -15,14 +15,14 @@ type ListView struct { func ListFrom(users []model.User, roles []groupenums.Role) []ListView { usersListView := make([]ListView, len(users)) - for i := 0; i < len(users); i++ { + for i, user := range users { usersListView[i] = ListView{ // Unlike other views, we do not fallback an empty name to // the username for the users' list view. - ID: users[i].ID, - Name: users[i].FullName, - Username: users[i].Username, - LoginProvider: users[i].LoginProvider.ToString(), + ID: user.ID, + Name: user.FullName, + Username: user.Username, + LoginProvider: user.LoginProvider.ToString(), Role: roles[i], } }