Questions tagged [martini]

Martini is a popular, lightweight web framework for Go.

Martini is a powerful package for quickly writing modular web applications/services in Go.

More information: https://github.com/codegangsta/martini

Contributed add-ons: https://github.com/codegangsta/martini-contrib

69 questions
2
votes
1 answer

golang gorp insert panic

Hi I'm using gorp and mysql. when insert struct gorp return reflect.Value.Interface: cannot return value obtained from unexported field or method In gorp docs says Panics if any interface in the list has not been registered with AddTablebut I added…
jen6
  • 68
  • 8
2
votes
3 answers

social network vk auth with martini

I am trying to use vk auth with martini. But have error on compile: /goPath/vkAuthTry2.go:38: undefined: YourRedirectFunc The question is how to define YourRedirectFunc function. Or if ask more widely I need working example of martini app with vk…
Maxim Yefremov
  • 13,671
  • 27
  • 117
  • 166
2
votes
2 answers

Go martini handling of HTML form data

I am having trouble getting data from the HTML form. The template shows at localhost:3000, I submit and am taken to localhost:3000/results with a "404 page not found" results. The URL does not include any of the forms fields. package main import…
cycle4passion
  • 3,081
  • 3
  • 14
  • 28
2
votes
1 answer

HAProxy is not load balancing due to persistent connections

We have a web server and a client, both written in go, that interact with each other. We want HAProxy to load balance requests between several instance of the server, but it's not working. The client will always connect to the same server while…
blockcipher
  • 2,144
  • 4
  • 22
  • 35
2
votes
1 answer

Martini Binding "cannot return value obtained from unexported field or method"

I have the following route: m.Post("/users", binding.Bind(models.User{}), func(user models.User, r render.Render) And I receive the following error message when I try to do a Post request: "PANIC: reflect.Value.Interface: cannot return value…
2
votes
1 answer

golang google oauth2 - not able to get user info (library : https://github.com/golang/oauth2)

i am using the following library for google oauth2 https://github.com/golang/oauth2 I am using the code given in the examples (url : http://play.golang.org/p/qXyuaVEhyS ,https://godoc.org/golang.org/x/oauth2/google ) I am able to get the auth code…
sanath_p
  • 2,198
  • 2
  • 26
  • 22
2
votes
2 answers

html/template: "layout" is undefined

I try to use martini framework with layout template: package main import ( "github.com/go-martini/martini" "github.com/martini-contrib/render" ) func main() { m := martini.Classic() m.Use(render.Renderer(render.Options{Directory:…
Maxim Yefremov
  • 13,671
  • 27
  • 117
  • 166
2
votes
1 answer

Martini templates and tests

I'm trying to split my application files from my testing files. It looks something like this: main.go views/ layouts/ layout.html spec/ main_test.go main.go creates a Martini app and tells Martini.render where to look for the views: func…
Ronze
  • 1,544
  • 2
  • 18
  • 33
2
votes
2 answers

Anyway to compress HTML output with Martini?

In a quasi-embedded environment so speed is everything. I have found that if I compress my .html files, the app is speedier. Is there a flag or way in Martini to do this on the fly?
2
votes
1 answer

How to inject an appengine.Context in martini

When I try to inject an appengine.Context from a middleware doing this: //Share Context m.Use(func(r *http.Request) { c := appengine.NewContext(r) c, err := appengine.Namespace(c, namespace) if err != nil { c.Debugf("[Namespace]…
Daviziko
  • 25
  • 3
1
vote
0 answers

How to validate API key with function in Martini?

So I currently have a function that will take in a string APIKey to check it against my Mongo collection. If nothing is found (not authenticated), it returns false - if a user is found, it returns true. My problem, however, is I'm unsure how to…
Zander
  • 123
  • 1
  • 2
  • 14
1
vote
0 answers

How to convert old middleware func to new middleware func

I have this existing library call: func Policy(quota *Quota, options ...*Options) func(resp http.ResponseWriter, req *http.Request) { o := newOptions(options) if o.Disabled { return func(resp http.ResponseWriter, req *http.Request)…
KC Johnson
  • 41
  • 1
  • 8
1
vote
0 answers

html template with martini in golang

I have problem with go, martini and how martini works with templates. package main import ( "github.com/go-martini/martini" "github.com/martini-contrib/render" ) type Page struct { Caption string Body string Tmpl …
insomniac669
  • 57
  • 1
  • 7
1
vote
1 answer

Go Martini Unit Test Example

I'm very new to Go and was wondering is there any convention/standard with examples on how to test Go Martini's Handler code? Thanking you in advance!
1
vote
1 answer

how to define column type in golang type struct as longtext?

I have this peace of code: type Post struct { Id int64 `db:"post_id"` Created int64 Title string `form:"Title"` Body string `form:"Body" binding:"required"` } but that gets me only 255 varchar for Body. How can i set that…
pregmatch
  • 2,629
  • 6
  • 31
  • 68