blue-jay / blueprint

Blueprint for your next web application in Go.
https://blue-jay.github.io/
MIT License
482 stars 77 forks source link

Question about context #69

Closed dstroot closed 7 years ago

dstroot commented 7 years ago

Please answer these questions when submitting your issue. Thanks!

  1. Which commit are you using? Latest

  2. Which operating system, processor architecture, and Go version are you using (go env)? GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/Dan/Go" GORACE="" GOROOT="/usr/local/opt/go/libexec" GOTOOLDIR="/usr/local/opt/go/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/74/lcddz0rx4h59vsj3bqwf0hg40000gn/T/go-build955806899=/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"

  3. What did you do? Nothing

  4. What did you expect to see? Nothing - I just have a question

  5. What did you actually see?

Prior to Go 1.7 context was an issue. After ctx was introduced I expected the use of gorilla/context to decline. I noticed you are using it here. Any thoughts to "go native" and use the built-in ctx now?

Note: gorilla/context, having been born well before `context.Context` existed, does not play well > with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`.
josephspurrier commented 7 years ago

That's a good question. I really love the standard library, but gorilla makes it pretty easy to get running with the sessions. You could however implement it yourself and then remove the dependency on gorilla/context. I haven't been spending much time on this project because work is taking up much of my free time, but my next focus for this project is to move the logic out of the controllers into services so the controllers and services are easier to test. You can see some of my progress in the clean-restructure branch, but I'm still not happy with it. Once that is done, I'd like to integrate Vue.js, remove sessions completely, and then use JWT for authentication and the http context where necessary.

dstroot commented 7 years ago

Thanks for the response. I am really impressed and learning quite a bit from your code structure. The arch is very clean - kudos for that! I like your priorities above. If I have anything to contribute I will submit a pull req. Cheers!

josephspurrier commented 7 years ago

Thanks so much! I appreciate the feedback!