package main import ( "fmt" "os" "time" "github.com/erikdubbelboer/gspt" ) func main() { // The initial process title is os.Args[0] fmt.Printf("PID: %d\n", os.Getpid()) fmt.Println("Initial process title should be 'proctitle_demo'") fmt.Println("Run 'ps -f -p ", os.Getpid(), "' in another terminal to check.") time.Sleep(15 * time.Second) // Set a new process title newTitle := "proctitle_demo (processing data)" gspt.SetProcTitle(newTitle) fmt.Println("\nProcess title changed!") fmt.Println("New title should be:", newTitle) fmt.Println("Run 'ps -f -p ", os.Getpid(), "' again to see the change.") // Keep the process alive to give you time to check for { time.Sleep(10 * time.Second) } }