0
respostas

erro ao rodar o programa: http: panic serving 127.0.0.1:49915: dial tcp: lookup localholst: no such host goroutine 20 [running]:

Aparece o seguinte erro ao rodar o programa: no navegador aparece: A conexão com localhost foi recusada. No terminal:

http: panic serving 127.0.0.1:49915: dial tcp: lookup localholst: no such host
goroutine 20 [running]:
net/http.(*conn).serve.func1()
        C:/Program Files/Go/src/net/http/server.go:1825 +0xbf
panic({0x4d5440, 0xc000088f60})
        C:/Program Files/Go/src/runtime/panic.go:844 +0x258
main.index({0x5cffb8?, 0xc000076000}, 0x0?)
        C:/Users/gabri/go/src/alura/main.go:42 +0x4d8
net/http.HandlerFunc.ServeHTTP(0x28d49aba648?, {0x5cffb8?, 0xc000076000?}, 0x1bd805?)
        C:/Program Files/Go/src/net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0x5cffb8, 0xc000076000}, 0xc00005e100)
        C:/Program Files/Go/src/net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc00001a180?}, {0x5cffb8, 0xc000076000}, 0xc00005e100)
        C:/Program Files/Go/src/net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc000094be0, {0x5d0218, 0xc0000c32f0})
        C:/Program Files/Go/src/net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
        C:/Program Files/Go/src/net/http/server.go:3071 +0x4db
2022/04/07 15:02:18 http: panic serving 127.0.0.1:49916: dial tcp: lookup localholst: no such host
goroutine 21 [running]:
net/http.(*conn).serve.func1()
        C:/Program Files/Go/src/net/http/server.go:1825 +0xbf
panic({0x4d5440, 0xc00028c000})
        C:/Program Files/Go/src/runtime/panic.go:844 +0x258
main.index({0x5cffb8?, 0xc0001300e0}, 0x0?)
        C:/Users/gabri/go/src/alura/main.go:42 +0x4d8
net/http.HandlerFunc.ServeHTTP(0x28d49aba558?, {0x5cffb8?, 0xc0001300e0?}, 0x1bd805?)
        C:/Program Files/Go/src/net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0x0?, {0x5cffb8, 0xc0001300e0}, 0xc000196000)
        C:/Program Files/Go/src/net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0xc0001821e0?}, {0x5cffb8, 0xc0001300e0}, 0xc000196000)
        C:/Program Files/Go/src/net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc000094c80, {0x5d0218, 0xc0000c32f0})
        C:/Program Files/Go/src/net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
        C:/Program Files/Go/src/net/http/server.go:3071 +0x4db