# Go function reference doesn't match

**URL:** <https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620>\
**Category:** Documentation\
**Tags:** server-framework\
**Created:** [March 14, 2023, 11:54am UTC](https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620 "2023-03-14T11:54:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/andrey/32/1495_2.png) [@Andrey](https://forum.heroiclabs.com/u/Andrey)\
**Post date:** [March 14, 2023, 11:54am UTC](https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620/1 "2023-03-14T11:54:13Z")

</div>

Hello, I am developing a clans system for our game and have found that a **GroupUpdate** request’s signature in the documentation ([Heroic Labs Documentation | Function Reference](https://heroiclabs.com/docs/nakama/server-framework/go-runtime/function-reference/#GroupUpdate)) doesn’t match to the signature of this method in the go runtime. There is userId parameter in the documentation, but actually it doesn’t exist in the go runtime

```auto
GroupUpdate(ctx context.Context, id, name, creatorID, langTag, description, avatarUrl string, open bool, metadata map[string]interface{}, maxCount int) error

```

So do I need:

- find the groups list for the user with **GroupUsersList** request ([Heroic Labs Documentation | Function Reference](https://heroiclabs.com/docs/nakama/server-framework/go-runtime/function-reference/#GroupUsersList))
- find the specified group in the received list list to receive a user role for the specified group
- handle permissions manually

Or maybe is there some better way to handle permissions?

---

<div class="post-metadata">

**Author:** ![tom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/tom/32/676_2.png) [@tom](https://forum.heroiclabs.com/u/tom)\
**Post date:** [March 14, 2023, 12:12pm UTC](https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620/2 "2023-03-14T12:12:48Z")

</div>

Hi @Andrey, thanks for reporting this issue. We’ll get the documentation updated to reflect the correct method signature.

With regards to permissions, the Groups functionality already supports the roles of Super Admin, Admin and Member. Please see [the documentation here](https://heroiclabs.com/docs/nakama/concepts/groups/#groups).

What are you trying to achieve regarding permissions?

---

<div class="post-metadata">

**Author:** ![Andrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/andrey/32/1495_2.png) [@Andrey](https://forum.heroiclabs.com/u/Andrey)\
**Post date:** [March 14, 2023, 1:45pm UTC](https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620/3 "2023-03-14T13:45:26Z")

</div>

Thanks for your reply @tom.  
I have read the documentation about the roles and that is exactly I need. But:

- our app sends a custom rpc with custom parameters
- we handle these parameters on the server
- than we call nk.GroupUpdate, but I assume that if I call this method on the go runtime - there is no validation of permission to update the group, because nk.GroupUpdate doesn’t have any information about the user that requested this action. So I thought that in this case I need to check the role of the user manually before calling nk.GroupUpdate in the way I described in the first message.

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [March 14, 2023, 1:57pm UTC](https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620/4 "2023-03-14T13:57:48Z")

</div>

@Andrey you’re correct, we’ll consider adding the userID as parameter in `GroupUpdate` in a future release, for now you can do permission checking by using `ListUserGroups` and inspecting whether the user has the correct state to be able to perform the update and then call `GroupUpdate` accordingly.

---

<div class="post-metadata">

**Author:** ![Andrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/andrey/32/1495_2.png) [@Andrey](https://forum.heroiclabs.com/u/Andrey)\
**Post date:** [March 14, 2023, 2:01pm UTC](https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620/5 "2023-03-14T14:01:56Z")

</div>

Thanks!  
so the simplest solution (without checking errors) to find the user’s role for the group with the go runtime looks like this:

```auto
func getUserState(ctx context.Context, nk runtime.NakamaModule, userID string, groupID string) int32 {
	userGroupsList, _, _ := nk.UserGroupsList(ctx, userID, 0, nil, "")

	for _, userGroup := range userGroupsList {
		if userGroup.Group.Id != groupID {
			continue
		}

		return userGroup.State.Value
	}

	return -1
}

```

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [March 14, 2023, 2:10pm UTC](https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620/6 "2023-03-14T14:10:34Z")

</div>

Yes that works, for reference in the thread, the states are the following:  
`superadmin(0), admin(1), member(2), join_request(3), banned(4)`

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [March 15, 2023, 6:54pm UTC](https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620/7 "2023-03-15T18:54:39Z")

</div>

Follow up - we’ve added support for the userID param in the GroupUpdate Go runtime function and it’ll be included in the next release.

---

<div class="post-metadata">

**Author:** ![Andrey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/andrey/32/1495_2.png) [@Andrey](https://forum.heroiclabs.com/u/Andrey)\
**Post date:** [March 16, 2023, 2:03pm UTC](https://forum.heroiclabs.com/t/go-function-reference-doesnt-match/3620/8 "2023-03-16T14:03:05Z")

</div>

Wow! You are very fast, thanks!
