golang-demo's Introduction
golang-demo's People
golang-demo's Issues
Error running in Docker
When i run from my local go distribution it is fine. (go build main.go; ./main
)
But, when I run in docker using the docker command:
docker run -p 8080:8080 [image_id]
i get the below error:
2020/03/20 19:01:26 http: panic serving 172.17.0.1:52008: runtime error: invalid memory address or nil pointer dereference
goroutine 34 [running]:
net/http.(*conn).serve.func1(0xc0000c4f00)
/usr/local/go/src/net/http/server.go:1772 +0x139
panic(0x78a1a0, 0xaec540)
/usr/local/go/src/runtime/panic.go:973 +0x3e3
html/template.(*Template).escape(0x0, 0x0, 0x0)
/usr/local/go/src/html/template/template.go:95 +0x3b
html/template.(*Template).Execute(0x0, 0x878340, 0xc000130000, 0x0, 0x0, 0x878480, 0xc00010c180)
/usr/local/go/src/html/template/template.go:119 +0x2f
main.indexHandler(0x87dd20, 0xc000130000, 0xc00019e000)
/go/src/golang-demo/main.go:33 +0xbf
net/http.HandlerFunc.ServeHTTP(0x80c430, 0x87dd20, 0xc000130000, 0xc00019e000)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xafc560, 0x87dd20, 0xc000130000, 0xc00019e000)
/usr/local/go/src/net/http/server.go:2387 +0x1a5
net/http.serverHandler.ServeHTTP(0xc0000fa000, 0x87dd20, 0xc000130000, 0xc00019e000)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc0000c4f00, 0x87e6a0, 0xc0000dc2c0)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c
2020/03/20 19:01:26 http: panic serving 172.17.0.1:52006: runtime error: invalid memory address or nil pointer dereference
goroutine 33 [running]:
net/http.(*conn).serve.func1(0xc0000c4e60)
/usr/local/go/src/net/http/server.go:1772 +0x139
panic(0x78a1a0, 0xaec540)
/usr/local/go/src/runtime/panic.go:973 +0x3e3
html/template.(*Template).escape(0x0, 0x0, 0x0)
/usr/local/go/src/html/template/template.go:95 +0x3b
html/template.(*Template).Execute(0x0, 0x878340, 0xc0000fa0e0, 0x0, 0x0, 0x878480, 0xc000099260)
/usr/local/go/src/html/template/template.go:119 +0x2f
main.indexHandler(0x87dd20, 0xc0000fa0e0, 0xc00011a000)
/go/src/golang-demo/main.go:33 +0xbf
net/http.HandlerFunc.ServeHTTP(0x80c430, 0x87dd20, 0xc0000fa0e0, 0xc00011a000)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xafc560, 0x87dd20, 0xc0000fa0e0, 0xc00011a000)
/usr/local/go/src/net/http/server.go:2387 +0x1a5
net/http.serverHandler.ServeHTTP(0xc0000fa000, 0x87dd20, 0xc0000fa0e0, 0xc00011a000)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc0000c4e60, 0x87e6a0, 0xc000108080)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c
2020/03/20 19:01:26 http: panic serving 172.17.0.1:52010: runtime error: invalid memory address or nil pointer dereference
goroutine 19 [running]:
net/http.(*conn).serve.func1(0xc000110140)
/usr/local/go/src/net/http/server.go:1772 +0x139
panic(0x78a1a0, 0xaec540)
/usr/local/go/src/runtime/panic.go:973 +0x3e3
html/template.(*Template).escape(0x0, 0x0, 0x0)
/usr/local/go/src/html/template/template.go:95 +0x3b
html/template.(*Template).Execute(0x0, 0x878340, 0xc0000fa1c0, 0x0, 0x0, 0x878480, 0xc000099350)
/usr/local/go/src/html/template/template.go:119 +0x2f
main.indexHandler(0x87dd20, 0xc0000fa1c0, 0xc00011a100)
/go/src/golang-demo/main.go:33 +0xbf
net/http.HandlerFunc.ServeHTTP(0x80c430, 0x87dd20, 0xc0000fa1c0, 0xc00011a100)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xafc560, 0x87dd20, 0xc0000fa1c0, 0xc00011a100)
/usr/local/go/src/net/http/server.go:2387 +0x1a5
net/http.serverHandler.ServeHTTP(0xc0000fa000, 0x87dd20, 0xc0000fa1c0, 0xc00011a100)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc000110140, 0x87e6a0, 0xc000108200)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c
2020/03/20 19:01:26 http: panic serving 172.17.0.1:52014: runtime error: invalid memory address or nil pointer dereference
goroutine 5 [running]:
net/http.(*conn).serve.func1(0xc000058000)
/usr/local/go/src/net/http/server.go:1772 +0x139
panic(0x78a1a0, 0xaec540)
/usr/local/go/src/runtime/panic.go:973 +0x3e3
html/template.(*Template).escape(0x0, 0x0, 0x0)
/usr/local/go/src/html/template/template.go:95 +0x3b
html/template.(*Template).Execute(0x0, 0x878340, 0xc0000fa2a0, 0x0, 0x0, 0x878480, 0xc000099470)
/usr/local/go/src/html/template/template.go:119 +0x2f
main.indexHandler(0x87dd20, 0xc0000fa2a0, 0xc000064100)
/go/src/golang-demo/main.go:33 +0xbf
net/http.HandlerFunc.ServeHTTP(0x80c430, 0x87dd20, 0xc0000fa2a0, 0xc000064100)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xafc560, 0x87dd20, 0xc0000fa2a0, 0xc000064100)
/usr/local/go/src/net/http/server.go:2387 +0x1a5
net/http.serverHandler.ServeHTTP(0xc0000fa000, 0x87dd20, 0xc0000fa2a0, 0xc000064100)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc000058000, 0x87e6a0, 0xc000062080)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c
2020/03/20 19:01:26 http: panic serving 172.17.0.1:52012: runtime error: invalid memory address or nil pointer dereference
goroutine 6 [running]:
net/http.(*conn).serve.func1(0xc0000580a0)
/usr/local/go/src/net/http/server.go:1772 +0x139
panic(0x78a1a0, 0xaec540)
/usr/local/go/src/runtime/panic.go:973 +0x3e3
html/template.(*Template).escape(0x0, 0x0, 0x0)
/usr/local/go/src/html/template/template.go:95 +0x3b
html/template.(*Template).Execute(0x0, 0x878340, 0xc000078000, 0x0, 0x0, 0x878480, 0xc000012270)
/usr/local/go/src/html/template/template.go:119 +0x2f
main.indexHandler(0x87dd20, 0xc000078000, 0xc000064000)
/go/src/golang-demo/main.go:33 +0xbf
net/http.HandlerFunc.ServeHTTP(0x80c430, 0x87dd20, 0xc000078000, 0xc000064000)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xafc560, 0x87dd20, 0xc000078000, 0xc000064000)
/usr/local/go/src/net/http/server.go:2387 +0x1a5
net/http.serverHandler.ServeHTTP(0xc0000fa000, 0x87dd20, 0xc000078000, 0xc000064000)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc0000580a0, 0x87e6a0, 0xc000062000)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c
2020/03/20 19:01:26 http: panic serving 172.17.0.1:52016: runtime error: invalid memory address or nil pointer dereference
goroutine 38 [running]:
net/http.(*conn).serve.func1(0xc0000c4fa0)
/usr/local/go/src/net/http/server.go:1772 +0x139
panic(0x78a1a0, 0xaec540)
/usr/local/go/src/runtime/panic.go:973 +0x3e3
html/template.(*Template).escape(0x0, 0x0, 0x0)
/usr/local/go/src/html/template/template.go:95 +0x3b
html/template.(*Template).Execute(0x0, 0x878340, 0xc0000780e0, 0x0, 0x0, 0x878480, 0xc000012360)
/usr/local/go/src/html/template/template.go:119 +0x2f
main.indexHandler(0x87dd20, 0xc0000780e0, 0xc00019e100)
/go/src/golang-demo/main.go:33 +0xbf
net/http.HandlerFunc.ServeHTTP(0x80c430, 0x87dd20, 0xc0000780e0, 0xc00019e100)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xafc560, 0x87dd20, 0xc0000780e0, 0xc00019e100)
/usr/local/go/src/net/http/server.go:2387 +0x1a5
net/http.serverHandler.ServeHTTP(0xc0000fa000, 0x87dd20, 0xc0000780e0, 0xc00019e100)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc0000c4fa0, 0x87e6a0, 0xc0000dc500)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.