Git Product home page Git Product logo

git-go-websiteskeleton's Issues

Import paths incompatible in godoc

Because this is intended to be installed in $GOPATH/src, godoc can't install it. This may represent a deeper problem - if the go community is making apps that assume installations under $GOPATH/src/, then perhaps we should just adhere to that.

Template rendering improvements

Suggestion from community - needs to be looked into:

  • You shouldn't reload/reparse templates at each request.
  • You should render/execute your template on a byte buffer, then copy that buffer to the http.ResponseWriter. Otherwise you will lose either IO errors or template errors. Either way, a bad idea.

access logging

Hey man, first of all I love the project. Have been using it to learn Go web development and it's been a big help.

I noticed a few flaws in your server access logging and wanted to point them out.

Your access logger takes a response writer, but it's never actually used. So the value for responseBytes is never set or reported, and the status will always be http.StatusOK regardless of what the actual status is.

I think some confusion might have arisen from trying to incorporate gorilla/mux, but the router return from mux.NewRouter actually implements the interface http.Handler and so the code from https://gist.github.com/cespare/3985516 can actually be used pretty much as -is.

I've written up my own gist demonstrating that. It's filled with comments to myself as I was going through both of your implementations line by line and I think it may prove helpful.
https://gist.github.com/pathouse/e74f9dc7919dd9f0ca88

Switch from template.Must to using the template pointer directly

As suggested:

template.Must() returns a pointer to a Template type which is cached (stored in RAM). You can execute content on this type with calling the pointer and calling the method ExecuteTemplate().
It is shown here: http://golang.org/doc/articles/wiki/#tmp_10
What you are doing is creating the same Template type over and over again with each request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.