Menu Close

Go – How to get numeric effective group id of the caller in go

Here, We will learn how to get numeric effective group id of the caller in go. We can do it by using Getegid() function in os package in go golang.

Function prototype:

func Getegid() int

Return value:

Getegid() function in os package returns 
the numeric effective group id of the caller.

Example with code:

package main

import "fmt"
import "os"


func main() {

  pid := os.Getegid()

  fmt.Println(pid)

}

Output:

20

To learn more about golang, Please refer given below link:

https://www.techieindoor.com/go-lang-tutorial/

References:

https://golang.org/doc/
https://golang.org/pkg/
Posted in golang, os

Leave a Reply

Your email address will not be published. Required fields are marked *