Standard library / os

os.Interrupt

Portable name for the interrupt signal value; sending it to a process is not supported on every OS. This fixture inspects the value without sending it. Example intended for Linux/AMD64 with Go 1.23.2 in a disposable working directory; other platforms may differ. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
var Interrupt Signal

Working Example

Example Snippetgo
package main
import (  "fmt"  "os"  "syscall")
func must(e error) {  if e != nil {    panic(e)  }}func main() { fmt.Println(os.Interrupt == syscall.SIGINT) }
Go Reference