Home »
Golang »
Golang Programs
How to get the group process identification using syscall in Golang?
Here, we will learn to get the group process identification using syscall in Golang.
Submitted by IncludeHelp, on November 12, 2021 [Last updated : March 05, 2023]
Getting the group process identification using syscall in Golang
In the Go programming language, to get the group process identification using syscall – we use the Getgid() function of the syscall package. The Getgid() function returns the real group ID of the calling process.
Syntax
func Getgid() (gid int)
Consider the below example demonstrating how to get the group process identification using syscall in Golang?
Golang code to get the group process identification using syscall
package main
import (
"fmt"
"syscall"
)
func main() {
// Using the Getgid(),
// Getting the group process
// identification
id := syscall.Getgid()
// Printing the group process
//identification
fmt.Println("Group ID:", id)
}
Output
Group ID: 14055
Golang syscall Package Programs »