Golang os.Getegid() Function with Examples

Golang | os.Getegid() Function: Here, we are going to learn about the Getegid() function of the os package with its usages, syntax, and examples.
Submitted by IncludeHelp, on November 18, 2021

os.Getegid()

In the Go language, the os package provides a platform-independent interface to operating system (Unix-like) functionality. The Getegid() function is an inbuilt function of the os package, it is used to get the numeric effective group id of the caller.

It accepts nothing and returns the numeric effective group id of the caller.

Note: On Windows Systems, it returns -1.

Syntax:

func Getegid() int

Parameter(s):

  • None

Return Value:

The return type of the os.Getegid() function is an int, it returns the numeric effective group id of the caller.

Example:

// Golang program to demonstrate the
// example of Getegid() function

package main

import (
	"fmt"
	"os"
)

func main() {
	id := os.Getegid()
	fmt.Printf("id: %T, %v\n", id, id)
}

Output:

id: int, 14054

Golang os Package »





Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.