Code generated by cmd/cgo; DO NOT EDIT.
line /usr/local/Cellar/go/1.16.3/libexec/src/os/user/getgrouplist_darwin.go:1:1 Copyright 2016 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+build cgo,!osusergo

package user
#include <unistd.h>#include <sys/types.h>#include <stdlib.h>
static int mygetgrouplist(const char* user, gid_t group, gid_t* groups, int* ngroups) { int* buf = malloc(*ngroups * sizeof(int)); int rv = getgrouplist(user, (int) group, buf, ngroups); int i; if (rv == 0) { for (i = 0; i < *ngroups; i++) { groups[i] = (gid_t) buf[i]; } } free(buf); return rv;}
import _ 
import (
	
	
)

func getGroupList(name * /*line :33:25*/_Ctype_char /*line :33:31*/, userGID  /*line :33:41*/_Ctype_gid_t /*line :33:48*/, gids * /*line :33:56*/_Ctype_gid_t /*line :33:63*/, n * /*line :33:68*/_Ctype_int /*line :33:73*/)  /*line :33:75*/_Ctype_int /*line :33:80*/ {
	return ( /*line :34:9*/_Cfunc_mygetgrouplist /*line :34:24*/)(name, userGID, gids, n)
}
groupRetry retries getGroupList with an increasingly large size for n. The result is stored in gids.
func groupRetry(username string, name []byte, userGID  /*line :39:55*/_Ctype_gid_t /*line :39:62*/, gids *[] /*line :39:72*/_Ctype_gid_t /*line :39:79*/, n * /*line :39:84*/_Ctype_int /*line :39:89*/) error {
	*n =  /*line :40:7*/_Ctype_int /*line :40:12*/(256 * 2)
	for {
		*gids = make([] /*line :42:18*/_Ctype_gid_t /*line :42:25*/, *n)
		rv := getGroupList((* /*line :43:24*/_Ctype_char /*line :43:30*/)(unsafe.Pointer(&name[0])), userGID, &(*gids)[0], n)
n is set correctly
			break
		}
		if *n > maxGroups {
			return fmt.Errorf("user: %q is a member of more than %d groups", username, maxGroups)
		}
		*n = *n *  /*line :51:13*/_Ctype_int /*line :51:18*/(2)
	}
	return nil