Skip to content

Instantly share code, notes, and snippets.

@hnts
Last active September 23, 2020 13:43
Show Gist options
  • Save hnts/0d71279575ea91e60b116d1423bd971f to your computer and use it in GitHub Desktop.
Save hnts/0d71279575ea91e60b116d1423bd971f to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
)
func main() {
fmt.Printf("User ID: %d\n", os.Getuid())
fmt.Printf("Group ID: %d\n", os.Getgid())
fmt.Printf("Effective User ID: %d\n", os.Geteuid())
fmt.Printf("Effective Group ID: %d\n", os.Getegid())
// Open a hnts2's file
f, err := os.Open("test.txt")
if err != nil {
fmt.Println(err)
}
defer f.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment