From 8bf23c70ffe0d3750b74c8e5909283bd6a0692fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20Sch=C3=B6ll?= Date: Thu, 7 Apr 2022 11:58:44 +0200 Subject: [PATCH] fix linting and error handling --- management/user.go | 4 ++-- management/user_test.go | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/management/user.go b/management/user.go index 2bdc8d19..9f96ae36 100644 --- a/management/user.go +++ b/management/user.go @@ -551,8 +551,8 @@ func (m *UserManager) Link(id string, il *UserIdentityLink, opts ...RequestOptio // Unlink unlinks an identity from a user making it a separate account again. // // See: https://auth0.com/docs/api/management/v2#!/Users/delete_user_identity_by_user_id -func (m *UserManager) Unlink(id, provider, userId string, opts ...RequestOption) (uIDs []UserIdentity, err error) { - err = m.Request("DELETE", m.URI("users", id, "identities", provider, userId), &uIDs, opts...) +func (m *UserManager) Unlink(id, provider, userID string, opts ...RequestOption) (uIDs []UserIdentity, err error) { + err = m.Request("DELETE", m.URI("users", id, "identities", provider, userID), &uIDs, opts...) return } diff --git a/management/user_test.go b/management/user_test.go index 5fa6354c..56485899 100644 --- a/management/user_test.go +++ b/management/user_test.go @@ -372,7 +372,6 @@ func TestUser(t *testing.T) { }) t.Run("Unlink", func(t *testing.T) { - cs, err := m.Connection.ReadByName("Username-Password-Authentication") if err != nil { t.Error(err) @@ -406,14 +405,20 @@ func TestUser(t *testing.T) { if err != nil { t.Error(err) } - jsonLinkedIdentities, _ := json.Marshal(linkedIdentities) + jsonLinkedIdentities, err := json.Marshal(linkedIdentities) + if err != nil { + t.Error(err) + } t.Logf("%v\n", string(jsonLinkedIdentities)) unlinkedIdentities, err := m.User.Unlink(mainUser.GetID(), "auth0", strings.TrimPrefix(secondaryUser.GetID(), "auth0|")) if err != nil { t.Error(err) } - jsonUnlinkedIdentities, _ := json.Marshal(unlinkedIdentities) + jsonUnlinkedIdentities, err := json.Marshal(unlinkedIdentities) + if err != nil { + t.Error(err) + } t.Logf("%v\n", string(jsonUnlinkedIdentities)) t.Cleanup(func() {