Getting meaningful information from exit statuses [SOLVED]

I’m trying to create a restful api using go. However for some reason after I successfully build the project. I run it and receive exit status 3221225506 a simple google search doesnt return me anything that makes any sense. So my question is what does 3221225506 mean is there a way for me to find the answer so that I dont have to bother you guys. I am new at go so apologies if this was an easy fix


import (
	// "fmt"
	"log"
	"net/http"
	"strings"
)

func handler(w http.ResponseWriter, r *http.Request) {
	for i, v := range r.Header {
		n, err := w.Write([]byte(i + ":   " + strings.Join(v, "")))
		if err != nil {
			log.Println(err)
			log.Println(n)
		}
	}
}

func main() {
	http.HandleFunc("/", handler)
	err := http.ListenAndServe(":8080", nil)
	if err != nil {
		log.Println(err)
	}
}

After adding package main to the beginning of this code, I built and ran it. Browsing to http://127.0.0.1:8080/ presented me with:

Connection: keep-aliveAccept-Language: en-usUpgrade-Insecure-Requests: 1Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4Dnt: 1Accept-Encoding: gzip, deflate

I am using go version go1.8.3 darwin/amd64.

The program did not exit until I killed it with ctrl-C.

Exit statuses are 8 bits - so there is no exit status 3221225506 as such. What should happen when you run your program is that either blocks with not output (listning for HTTP requests) or prints and error and exits with code zero (as it’s a return from main()).

Maybe show what you do and what you see, more precisely?

This is what I want, however doesn’t happen on my machine

I say go run file name it tries to run it I assume and then on my console says exit status 3221225506.

I’m not sure how else to explain it.

That’s a permission denied error on Windows. My top tip would be to disable your antivirus and stuff.

2 Likes

Interesting so it has nothing to do with go?

The program looks like it should work, and works for us who try it, so I suspect that no, it doesn’t. But your antivirus might block running new executables, or executables in a temp directory, or something like that.

1 Like

I ran into this problem and had trouble finding answers on the net – have you checked if your Window machine’s “Application Experience” service is running?

So the error ended up happening when I ran Go out of powershell if I run it in regular command line then everything works. I don’t know why tho…

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