Questions tagged [revel]

A high-productivity web framework for the Go language.

Features

Hot Code Reload

Edit, save, and refresh. Revel compiles your code and templates for you, so you don't miss a beat. Code doesn't compile? It gives you a helpful description. Run-time code panic? Revel has you covered.

Comprehensive

Revel provides routing, parameter parsing, validation, session/flash, templating, caching, job running, a testing framework, and even internationalization.

High Performance

Revel builds on top of the Go HTTP server, which was recently benchmarked to serve three to ten times as many requests as Rails across a variety of loads.

Framework Design

Synchronous

The Go HTTP server runs each request in its own goroutine. Write simple callback-free code without guilt.

Stateless

Revel provides primitives that keep the web tier stateless for predictable scaling. For example, session data is stored in the user cookie, and the cache is backed by a memcached cluster.

Modular

Revel is built around composable middleware called filters, which implement nearly all request-processing functionality. Developers have the freedom to replace the default filters with custom implementations (e.g. a custom router).

Source: project home page

206 questions
50
votes
4 answers

How to add variable to string variable in golang

I'm trying to add a value to a variable string in golang, without use printf because I'm using revel framework and this is for a web enviroment instead of console, this is the case: data := 14 response := `Variable string content` so I can't get…
omalave
  • 775
  • 1
  • 8
  • 15
31
votes
1 answer

How to return dynamic type struct in Golang?

I am using Golang Revel for some web project and I did like 12 projects in that so far. In all of them I have a lot of code redundancy because of return types. Look at this two functions: func (c Helper) Brands() []*models.Brand{ //do some…
pregmatch
  • 2,629
  • 6
  • 31
  • 68
21
votes
2 answers

Golang requirements.txt equivalent

Coming from a python/django world, it'd be great to have something like a requirements.txt equivalent for go/revel. How can I do this? I know I can just write a requirements.txt file and then do something like cat requirements | xargs go get But…
mangoman
  • 219
  • 2
  • 4
19
votes
3 answers

how to reference a relative file from code and tests

I need to reference patients.json from patients.go, here's the folder structure: If I do: filepath.Abs("../../conf/patients.json") it works for go test ./... but fails for revel run If I do: filepath.Abs("conf/patients.json") the exact opposite…
Pablo Fernandez
  • 103,170
  • 56
  • 192
  • 232
14
votes
1 answer

Golang pq: syntax error when executing sql

Using revel, golang 1.1.2, gorp, postgres 9.3.2 on heroku Following robfig's List booking example func (c App) ViewPosts(page int) revel.Result { if page == 0 { page = 1 } var posts []*models.Post size := 10 posts =…
Derek
  • 11,980
  • 26
  • 103
  • 162
11
votes
1 answer

range within range golang template

How to access range within range in Go templates? Template: {{range .Resume.Skills}} {{.Name}} {{.Level}} {{range $item, $key := .Keywords}} {{$key}} {{$item}} {{end}} {{end}} Struct: type SkillsInfo…
Mangirdas
  • 243
  • 1
  • 3
  • 9
10
votes
4 answers

Iterate Go map get index

In order to use revel's even keyword in templates I would like to get the index of a map entry when iterating with range. Is there any way to do so? My map has the structure: map[string][]string
DiCaprio
  • 823
  • 1
  • 7
  • 24
10
votes
1 answer

URL Escaping producing "%A(MISSING)" instead of "%3A"

I am using the revel framework with the go language. Recently, when I run the following code: import ( ... "net/url" ... ) revel.INFO.Println(url.QueryEscape("http://hello.com")) I get INFO 2014/07/09 14:58:34 user.go:39:…
Bjorn Roche
  • 11,279
  • 6
  • 36
  • 58
7
votes
4 answers

Go: Dynamic type cast/assertion of struct's with interface (to call methods and use struct commons)

I cracked my brain trying to make my code shorter and cleaner. The problem is in one function, that is working with different structs, that implements one interface. In some cases I need the model variable to implement the structure (slice of…
Altenrion
  • 764
  • 3
  • 14
  • 35
5
votes
1 answer

Is it possible to debug go revel framework from Visual Studio Code?

I'm trying to debug a revel app with visual studio but I can't get it to work. I've seen this question how to debug revel framework(golang) application in visual studio code(vscode) but no answers yet... I've tried with this config: { …
zapico
  • 2,396
  • 1
  • 21
  • 45
5
votes
3 answers

Go JSON decoding is very slow. What would be a better way to do it?

I am using Go, Revel WAF and Redis. I have to store large json data in Redis (maybe 20MB). json.Unmarshal() takes about roughly 5 seconds. What would be a better way to do it? I tried JsonLib, encode/json, ffjson, megajson, but none of them were…
shiro_goto
  • 53
  • 1
  • 1
  • 3
5
votes
4 answers

How to access Gorm in Revel Controller?

let me start by saying these are my first couple days of toying around in Go. I'm trying to use the Revel framework with Gorm like this: app/controllers/gorm.go package controllers import ( "fmt" "go-testapp/app/models" _…
Martijn19
  • 189
  • 4
  • 13
5
votes
2 answers

Revel framework and Go code completion

is is possible to use Revel framework with Go code completion support. As far as i know the gocode utility requires the code to be compiled into a library into a pkg subfolder in order to function, but the framework does compilation on the fly. I am…
5
votes
1 answer

Output all language strings in Revel?

I'm developing an API Server in Go and the server (at the moment) handles all translations for clients. When an API client fetches particular data it also asks for the translations that are available for the given section. Ideally I want to have the…
Peter
  • 3,144
  • 11
  • 37
  • 56
4
votes
1 answer

Go pprof: Got Error unrecognized profile format

I'm developing a web program with Go revel framework(my go version is 1.6.2). And I got issues with the memory usage. The memory occupied by revel is increasing almost hundreds of MB every day. So I want to tune the program. Then I learn to use the…
Victor
  • 51
  • 1
  • 6
1
2 3
13 14