systemd is the init system and service manager on most modern Linux distributions. See Linux for the systemctl and journalctl cheatsheet.
Example Unit File
/etc/systemd/system/golang-test.service:
[Unit]
Description=golang test
StartLimitBurst=1000
[Service]
User=root
WorkingDirectory=/root
ExecStart=/root/main
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.targetAfter editing:
systemctl daemon-reload
systemctl enable --now golang-test.service
journalctl -fu golang-test.service