yang-f / beauty Goto Github PK
View Code? Open in Web Editor NEWA microframework based on mymysql,net/http,jwt-go and mux.
License: MIT License
A microframework based on mymysql,net/http,jwt-go and mux.
License: MIT License
早就觉得 golang 不需要什么框架了.
你总结的很好👍
open url :http://localhost:8080/demo3
open url :http://localhost:8080/demo1
2018/01/25 20:04:14 http: panic serving [::1]:53314: runtime error: invalid memory address or nil pointer dereference
goroutine 7 [running]:
net/http.(*conn).serve.func1(0xc420085ea0)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:1697 +0xd0
panic(0x13b8960, 0x1654240)
/usr/local/Cellar/go/1.9.2/libexec/src/runtime/panic.go:491 +0x283
github.com/yang-f/beauty/utils/token.Valid(0x0, 0x0, 0x14297f6, 0xd, 0x167fde0, 0xc4200428f0)
/Users/liberxue/golang/src/github.com/yang-f/beauty/utils/token/token.go:50 +0x54
github.com/yang-f/beauty/decorates.Handler.Auth.func1(0x1627b80, 0xc42011a000, 0xc420118200, 0x0)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/auth.go:48 +0x9f
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc420042d10, 0x1627b80, 0xc42011a000, 0xc420118200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.Handler.Verify.func1(0x1627b80, 0xc42011a000, 0xc420118200, 0x142f354)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/verify.go:61 +0x79d
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc420042d20, 0x1627b80, 0xc42011a000, 0xc420118200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.CorsHeader.func1(0x1627b80, 0xc42011a000, 0xc420118200, 0x142935e)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/cors.go:41 +0x1d3
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200432e0, 0x1627b80, 0xc42011a000, 0xc420118200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.ContentType.func1(0x1627b80, 0xc42011a000, 0xc420118200, 0x1086296)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/contentType.go:33 +0xb3
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200dcc40, 0x1627b80, 0xc42011a000, 0xc420118200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.Logger.func1(0x1627b80, 0xc42011a000, 0xc420118200, 0x12b31fa)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/logger.go:36 +0xa1
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200dcc60, 0x1627b80, 0xc42011a000, 0xc420118200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/gorilla/mux.(*Router).ServeHTTP(0xc420108770, 0x1627b80, 0xc42011a000, 0xc420118200)
/Users/liberxue/golang/src/github.com/gorilla/mux/mux.go:159 +0xed
net/http.serverHandler.ServeHTTP(0xc42007bc70, 0x1627b80, 0xc42011a000, 0xc420118000)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:2619 +0xb4
net/http.(*conn).serve(0xc420085ea0, 0x1628240, 0xc42005c5c0)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:1801 +0x71d
created by net/http.(*Server).Serve
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:2720 +0x288
2018/01/25 20:04:14 http: panic serving [::1]:53315: runtime error: invalid memory address or nil pointer dereference
goroutine 18 [running]:
net/http.(*conn).serve.func1(0xc420168000)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:1697 +0xd0
panic(0x13b8960, 0x1654240)
/usr/local/Cellar/go/1.9.2/libexec/src/runtime/panic.go:491 +0x283
github.com/yang-f/beauty/utils/token.Valid(0x0, 0x0, 0x14297f6, 0xd, 0x167fde0, 0xc4200428f0)
/Users/liberxue/golang/src/github.com/yang-f/beauty/utils/token/token.go:50 +0x54
github.com/yang-f/beauty/decorates.Handler.Auth.func1(0x1627b80, 0xc420182000, 0xc420172200, 0x0)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/auth.go:48 +0x9f
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc420042d10, 0x1627b80, 0xc420182000, 0xc420172200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.Handler.Verify.func1(0x1627b80, 0xc420182000, 0xc420172200, 0x142f354)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/verify.go:61 +0x79d
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc420042d20, 0x1627b80, 0xc420182000, 0xc420172200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.CorsHeader.func1(0x1627b80, 0xc420182000, 0xc420172200, 0x142935e)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/cors.go:41 +0x1d3
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200432e0, 0x1627b80, 0xc420182000, 0xc420172200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.ContentType.func1(0x1627b80, 0xc420182000, 0xc420172200, 0x1086296)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/contentType.go:33 +0xb3
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200dcc40, 0x1627b80, 0xc420182000, 0xc420172200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.Logger.func1(0x1627b80, 0xc420182000, 0xc420172200, 0x12b31fa)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/logger.go:36 +0xa1
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200dcc60, 0x1627b80, 0xc420182000, 0xc420172200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/gorilla/mux.(*Router).ServeHTTP(0xc420108770, 0x1627b80, 0xc420182000, 0xc420172200)
/Users/liberxue/golang/src/github.com/gorilla/mux/mux.go:159 +0xed
net/http.serverHandler.ServeHTTP(0xc42007bc70, 0x1627b80, 0xc420182000, 0xc420172000)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:2619 +0xb4
net/http.(*conn).serve(0xc420168000, 0x1628240, 0xc42011c080)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:1801 +0x71d
created by net/http.(*Server).Serve
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:2720 +0x288
2018/01/25 20:04:15 http: panic serving [::1]:53321: runtime error: invalid memory address or nil pointer dereference
goroutine 34 [running]:
net/http.(*conn).serve.func1(0xc4201e6000)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:1697 +0xd0
panic(0x13b8960, 0x1654240)
/usr/local/Cellar/go/1.9.2/libexec/src/runtime/panic.go:491 +0x283
github.com/yang-f/beauty/utils/token.Valid(0x0, 0x0, 0x14297f6, 0xd, 0x167fde0, 0xc4200428f0)
/Users/liberxue/golang/src/github.com/yang-f/beauty/utils/token/token.go:50 +0x54
github.com/yang-f/beauty/decorates.Handler.Auth.func1(0x1627b80, 0xc420212000, 0xc420202200, 0x0)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/auth.go:48 +0x9f
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc420042d10, 0x1627b80, 0xc420212000, 0xc420202200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.Handler.Verify.func1(0x1627b80, 0xc420212000, 0xc420202200, 0x142f354)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/verify.go:61 +0x79d
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc420042d20, 0x1627b80, 0xc420212000, 0xc420202200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.CorsHeader.func1(0x1627b80, 0xc420212000, 0xc420202200, 0x142935e)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/cors.go:41 +0x1d3
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200432e0, 0x1627b80, 0xc420212000, 0xc420202200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.ContentType.func1(0x1627b80, 0xc420212000, 0xc420202200, 0x1086296)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/contentType.go:33 +0xb3
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200dcc40, 0x1627b80, 0xc420212000, 0xc420202200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.Logger.func1(0x1627b80, 0xc420212000, 0xc420202200, 0x12b31fa)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/logger.go:36 +0xa1
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200dcc60, 0x1627b80, 0xc420212000, 0xc420202200)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/gorilla/mux.(*Router).ServeHTTP(0xc420108770, 0x1627b80, 0xc420212000, 0xc420202200)
/Users/liberxue/golang/src/github.com/gorilla/mux/mux.go:159 +0xed
net/http.serverHandler.ServeHTTP(0xc42007bc70, 0x1627b80, 0xc420212000, 0xc420202000)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:2619 +0xb4
net/http.(*conn).serve(0xc4201e6000, 0x1628240, 0xc4201fa040)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:1801 +0x71d
created by net/http.(*Server).Serve
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:2720 +0x288
2018/01/25 20:04:15 http: panic serving [::1]:53322: runtime error: invalid memory address or nil pointer dereference
goroutine 20 [running]:
net/http.(*conn).serve.func1(0xc420168280)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:1697 +0xd0
panic(0x13b8960, 0x1654240)
/usr/local/Cellar/go/1.9.2/libexec/src/runtime/panic.go:491 +0x283
github.com/yang-f/beauty/utils/token.Valid(0x0, 0x0, 0x14297f6, 0xd, 0x167fde0, 0xc4200428f0)
/Users/liberxue/golang/src/github.com/yang-f/beauty/utils/token/token.go:50 +0x54
github.com/yang-f/beauty/decorates.Handler.Auth.func1(0x1627b80, 0xc4201820e0, 0xc420172700, 0x0)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/auth.go:48 +0x9f
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc420042d10, 0x1627b80, 0xc4201820e0, 0xc420172700)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.Handler.Verify.func1(0x1627b80, 0xc4201820e0, 0xc420172700, 0x142f354)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/verify.go:61 +0x79d
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc420042d20, 0x1627b80, 0xc4201820e0, 0xc420172700)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.CorsHeader.func1(0x1627b80, 0xc4201820e0, 0xc420172700, 0x142935e)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/cors.go:41 +0x1d3
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200432e0, 0x1627b80, 0xc4201820e0, 0xc420172700)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.ContentType.func1(0x1627b80, 0xc4201820e0, 0xc420172700, 0x1086296)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/contentType.go:33 +0xb3
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200dcc40, 0x1627b80, 0xc4201820e0, 0xc420172700)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/yang-f/beauty/decorates.Logger.func1(0x1627b80, 0xc4201820e0, 0xc420172700, 0x12b31fa)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/logger.go:36 +0xa1
github.com/yang-f/beauty/decorates.Handler.ServeHTTP(0xc4200dcc60, 0x1627b80, 0xc4201820e0, 0xc420172700)
/Users/liberxue/golang/src/github.com/yang-f/beauty/decorates/http.go:34 +0x48
github.com/gorilla/mux.(*Router).ServeHTTP(0xc420108770, 0x1627b80, 0xc4201820e0, 0xc420172700)
/Users/liberxue/golang/src/github.com/gorilla/mux/mux.go:159 +0xed
net/http.serverHandler.ServeHTTP(0xc42007bc70, 0x1627b80, 0xc4201820e0, 0xc420172500)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:2619 +0xb4
net/http.(*conn).serve(0xc420168280, 0x1628240, 0xc42011c340)
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:1801 +0x71d
created by net/http.(*Server).Serve
/usr/local/Cellar/go/1.9.2/libexec/src/net/http/server.go:2720 +0x288
Liberxue:beauty liberxue$ go env
GOARCH="amd64"
GOBIN="/Users/liberxue/golang/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/liberxue/golang"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1b/57_cycb550z9qdp5y7p_6drc0000gn/T/go-build226069681=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.