air: Dependency Headaches: some things aren't importing for reasons unknown

Simply cannot import /text/langauge for some reason.

go version
     go version go1.11.2 windows/amd64

go get -u golang.org/x/text/language
     go: finding golang.org/x/text/language latest
     go get golang.org/x/text/language: no matching versions for query "latest"

on my DigitalOcean Debian server, there’s been some trouble with these:

go: github.com/tdewolff/minify/v2@v2.3.7: go.mod has non-.../v2 module path "github.com/tdewolff/minify" (and .../v2/go.mod does not exist) at revision v2.3.7
go: error loading module requirements

though on my windows devbox it works fine.


on a side note, massive updates today, wow! This project is growing and getting better everyday 😲, it’s hard to keep up lol. But it’s all good, many of the changes in the last day have been breaking (to me at least), so I’m going to stick to the vanilla version as it is and simply write my extentions in an extention.go file as I see no reason to tediously duplicate all the awesome progress and developments you’re driving.

The only reason for my fork was to add a couple of convenience features, like:

  • native msgpack support in binder.go and response.go
  • req.Query("param") is a nice to have feature
  • .SetCookie(name, http.Cookie), or, gin style .SetCookie(name, all_the_params_laid_flat...)
  • req.Cookie(name) -> string, and, req.GetCookie(name) -> *Cookie
  • Coffer Gzip support, and Gzip support generally
  • Streaming, which got solved already, thanks 👍
  • Plain http middleware support
    • specifically: throttled, which could make for a nice gas
  • +Various Header methods that make life easier.
  • cache-control related concerns, autocert things
  • HostWhiteList stuff, redirecting localhost to the main domain when in debug mode which was annoying, I wish there was a toggle.

And I see you’ve added many of these features already, so I’m wondering if perhaps we could reach consensus on some of these features so that they can potentially be integrated and made official.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 50 (50 by maintainers)

Most upvoted comments

Mad? Haha, relax. I don’t mind too much about this kind of thing. After all, I chose the Unlicense for all my open source projects, didn’t I? If you can give me feedback in time when you find a bug, then I will be very happy.

Haha, I saw it, not bad. 👍

I should sleep now, so sleepy… 😪

I prefer this:

c := req.Cookie("authorization")
if c == nil {
	res.Status = 401
	return errors.New("unauthorized")
}

return CheckAuthorization(c.Value)

Whether the value of the cookie matches should be handled by the CheckAuthorization(). After all, the empty string are just a case (of mismatch) isn’t it?

Also, I don’t like the GetCookie name. See Effective Go, section Getters.

Sigh… In fact, I don’t want to expose those fields because I always have a thought of implementing the HTTP server myself (just like the valyala/fasthttp). So, I didn’t plan to do it until I gave up that idea.

I prefer to add the WrapHTTPMiddleware(). Could you please submit a PR for it? I’m working something else now.

func WrapHTTPMiddleware(m func(http.Handler) http.Handler) Gas {
	return func(next Handler) Handler {
		return func(req *Request, res *Response) error {
			var err error
			m(http.HandlerFunc(func(
				rw http.ResponseWriter,
				r *http.Request,
			) {
				req.request = r
				res.writer = rw
				err = next(req, res)
			})).ServeHTTP(res.writer, req.request)
			return err
		}
	}
}