Go web server shuts down

You could try something like this:

package main

import (
	"log"
	"os"
)

func main() {
	// Create a new logger l for output to stderr.
	// If you don't want the log date, change the flag from 1 to 0.
	l := log.New(os.Stderr, "", 1)
	
	// Some code to force an error.
	file, err := os.Open("file.go") // For read access.
	if err != nil {
		// Output the error do stderr
		l.Println(err)
	}
	_ = file // just to avoid errors at compile time
}
1 Like

Isn’t .exe a windows thing? I think the main program should be named main.go.

the main executable on Linux does not have a suffix AFAIK.

./main

Does dmesg show anything?

var/log/dmesg is empty…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.