Go lang

114 views
Skip to first unread message

krishma...@gmail.com

unread,
Mar 18, 2020, 10:33:06 AM3/18/20
to golang-nuts
I have crud example of insert on localhost when i start with server http://localhost:8080 i get the view  of apache Tomcat/8.5.43

So can u please help me out exactly what i have to write in url so that i can get the output of form.
Below i have attached my go and template file if any changes please revert me
index.tmpl
main.go

Brian Candler

unread,
Mar 18, 2020, 11:17:36 AM3/18/20
to golang-nuts
It sounds like you have Tomcat running, and it's listening on port 8080.  If that's the case, then your go program will be unable to bind a listening socket on port 8080 at the same time.  Either modify your go program to bind to a different port; or stop Tomcat before starting your go program; or modify the Tomcat config to bind to a different port, and restart it.

Note that you should have seen an error message from your go program telling you the problem.  http.ListenAndServe returns an error - but unfortunately you threw that value away, so you see nothing.

Go doesn't have exceptions.  It's up to you to put the error value returned by a function in a variable, and do something useful with it. e.g.

err := http.ListenAndServe(":8080",nil)
if err != nil {
    fmt.Println(err)
        }

Reply all
Reply to author
Forward
0 new messages