Improve this page on GitHub

beego 1.7.1

New features:

  1. Added IP for access log #2156
  2. ReadForUpdate or ORM #2158
  3. Parameters binding supports form,columns[0].Data=foo&columns[1].Data=bar&columns[2].Data=baz #2111
  4. Added beego.BConfig.RecoverFunc for custom recover method. #2004
  5. memcache cache supports byte and string. So as to cache struct by gob#1521
  6. ORM delete by condition. #1802
  7. swagger doc supports yaml #2162
  8. Added RunController and RunMethod for customized router rules #2017

Bug fixes:

  1. No / added while visiting static folder who contains index.html. For example visit /swagger won’t redirect to /swagger/ so that relitive css and js won’t be access. #2142
  2. Time in Beego admin UI displayed alphabetically other than ordered by us or ms. #1877
  3. Crash while captcha generates by custom height and width. #2161
  4. Panic while empty body requested with DELETE method when CopyBody enabled. #1656

beego 1.7.0

New features:

  1. Improved Filter speed by 7.5+ times #1799
  2. Multiple level for Gzip compression #1808
  3. Negative numbers for ORM PK #1810
  4. Custom auto-increasing ID for ORM #1826
  5. Improved Context file downloading: check file existence before download#1827
  6. GetLogger method for log module #1832
package main

import ""

func main() {
    logs.Warn("this is a warn message")

    l := logs.GetLogger("HTTP")
    l.Println("this is a message of http")

    logs.GetLogger("orm").Println("this is a message of orm")

    logs.Debug("my book is bought in the year of ", 2016)
    logs.Info("this %s cat is %v years old", "yellow", 3)
    logs.Error(1024, "is a very", "good", 2.5, map[string]int{"id": 1})
    logs.Critical("oh my god")

  1. Log for session if error occurred. #1833
  2. Public methods for logs: EnableFuncCallDepth and SetLogFuncCallDepth for setting function call level. #1837
  3. Use go run to run beego project #1840
  4. Added ExecuteTemplate method which is used to access template other than use map since map is not safe for concurrent reading and writing. #1848
  5. time type for ORM field #1856
  6. ORM One only fetch one record #1874
  7. ORM suports json jsonb type #1875
  8. ORM uses text type by default. #1879
  9. session configurations: EnableSidInHttpHeader EnableSidInUrlQuery SessionNameInHttpHeader let user pass sid in http header or in URL. #1897
  10. Shorten fileanme of auto-generated router file name. #1924
  11. Complex template engine. ace jade #1940
    beego.AddTemplateEngine(“ace”, func(root, path string, funcs template.FuncMap) (*template.Template, error) {

    aceOptions := &ace.Options{DynamicReload: true, FuncMap: funcs}
    aceBasePath := filepath.Join(root, "base/base")
    aceInnerPath := filepath.Join(root, strings.TrimSuffix(path, ".ace"))
    tpl, err := ace.Load(aceBasePath, aceInnerPath, aceOptions)
    if err != nil {
        return nil, fmt.Errorf("error loading ace template: %v", err)
    return tpl, nil


  12. session suports ssdb #1953

  13. RenderForm supports required #1993

  14. Beautified beego logs #1997

  15. ORM suports time.Time pointer in struct #2006

  16. TplPrefix in Controller for setting prefix folder in baseController #2030

  17. js function checking in jsonb to avoid non-exist methods. #2045

  18. InsertOrUpdate method in ORM #2053

  19. Filter method added parameter for resetting parameters. Because when using beego.InsertFilter("*", beego.BeforeStatic, RedirectHTTP)
    parameter will be assigned to :splat which will affect other useful routers. #2085

  20. session initialized by object other than json. It might have issue for the projects use session module separately. #2096

  21. Upgraded Swagger to 2.0. The code generated now doesn’t rely on API. beego generat swagger.json directly.


  1. /m redirect to /m/ automatically in static reouters. #1792
  2. Parsing config file error while testing #1794
  3. Race condition while rotate file. #1803
  4. Fixed multiple response.WriteHeader calls error. #1805
  5. Fixed panic if primary key is uint in ORM #1828
  6. Fixed panic if current time is less than 2000 while rotate logs. [#]()
  7. Fixed XSRF reuse caused by context reuse.#1863
  8. Panic while InsertMulti * type in ORM #1882
  9. Multiple execution of task in a very short time. #1909
  10. Garbled file name in IE #1912
  11. ORM DISTINCT #1938
  12. Can’t use int while setting file permit in Logs module. #1948 #2003
  13. Empty foreign key for QueryRow and QueryRows. #1964
  14. Retrieving scheme from X-Forwarded-Proto when it isn’t none. #2050
  15. Add query parameters for redirecting static path to path/ #2064

beego 1.6.1

New features

  1. Oracle driver for ORM
  2. inline mode for ORM Model
  3. ssdb engine for Cache
  4. Color scheme configure for console out
  5. travis integration
  6. mulitfile engine for Log. Write logs from different levels to different files.


  1. cookie time config
  2. Router rule mapping #1580
  3. No logs before beego.Run()
  4. Returning nil while []string is empty in config
  5. Wrong comment for ini engine
  6. Log time delay while store log asynchronously
  7. Config file parsed twice.
  8. Can’t handle () in URL for regex router.
  9. Chinese encoding issue in mail
  10. No Distinct in ORM
  11. Compiling error in Layout
  12. Wrong file name in logrotate
  13. Invalid CORS if CORS plugin fail.
  14. Conflicting between path params and router params in filters
  15. Return 404 other than 200 if static files are not found.
  16. Added GroupBy interface
  17. Static file crush caused by accessing map concurrently of Go 1.6
  18. Extra newline output by json.Encoder of JSONBody in httplib
  19. Missing log when Close if use flush in log under asynchronous mode.

beego 1.6.0

New features:

  1. log supports rotating files like xx.2013-01-01.2.log #1265
  2. context.response supports Flush, Hijack, CloseNotify
  3. ORM supports Distinct #1276
  4. map_get template method #1305
  5. ORM supports tidb engine #1366
  6. httplib request supports []string #1308
  7. ORM querySeter added GroupBy method #1345
  8. Session’s MySQL engine supports custom table name #1348
  9. Performance of log’s file engine improved 30%; Supports set log file’s permission #1560
  10. Get session by query #1507
  11. Cache module supports multiple Cache objects.
  12. validation supports custom validation functions


  1. bind method in context caused crash when parameter is empty. #1245
  2. manytomany in ORM reverse error #671
  3. http: multiple response.WriteHeader calls #1329
  4. ParseForm uses local timezone while parsing date #1343
  5. Emails sent by log’s SMTP engine can’t be authorised
  6. Fixed some issues in router: /topic/:id/?:auth, /topic/:id/?:auth:int #1349
  7. Fixed the crash caused by nil while parsing comment documentation. #1367
  8. Can’t read index.html in static folder
  9. dbBase.Update doesn’t return err if failed #1384
  10. Required in validation only works for int but not for int64
  11. orm: Fix handling of rel(fk) to model with string pk #1379
  12. graceful error while both http and https enabled #1414
  13. If ListenTCP4 enabled and httpaddr is empty, it still listens TCP6
  14. migration doesn’t support postgres #1434
  15. Default values of ORM text, bool will cause error while creating tables.
  16. graceful panic: negative WaitGroup counter


  1. Moved example to samples
  2. Passed golint
  3. Rewrote router, improved performance by 3 times.
  4. Used sync.Pool for context to improve performance
  5. Improved template compiling speed. #1298
  6. Improved config
  7. Refactored whole codebase for readability and maintainability
  8. Moved all init code into AddAPPStartHook
  9. Removed middleware. Will only use plugins
  10. Refactored Error handling.

Beego 1.5.0

New Features:

  1. Graceful shutdown
  2. Added JsonBody method to httplib which supporting sending raw body as JSON format
  3. Added AcceptsHtml AcceptsXml AcceptsJson methods to context input
  4. Get config files from Runmode first
  5. httplib supports gzip
  6. log module stop using asynchronous mode by default
  7. validation supports recursion
  8. Added apk mime
  9. ORM supports eq an ne


  1. Wrong parameters for ledis driver.
  2. When user refresh the page after the captcha code expired from the cache, it returns 404. Generating new captcha code for reloading.
  3. Controller defines Error exception
  4. cookie doesn’t work in window IE
  5. GetIn returns nil error while getting non-exist variable
  6. More cellphone validation code
  7. Wrong router matching
  8. The panic returns http 200
  9. The database setting erros caused by redis session
  10. The issue that https and http don’t share session
  11. Memcache session driver returns error if it’s empty

Beego 1.4.3

New Features:

  1. ORM support default settting
  2. improve logs/file line count
  3. sesesion ledis support select db
  4. session redis support select db
  5. cache redis support select db
  6. UrlFor support all type of the parameters
  7. controller GetInt/GetString function support default value, like: GetInt("a",12)
  8. add CompareNot/NotNil template function
  9. support Controller defeine error,controller Error
  10. ParseForm support slices of ints and strings
  11. improve ORM interface


  1. context get wrong subdomain
  2. beego.AppConfig.Strings when the strings is empty, always return []string{}
  3. utils/pagination can’t modify the attributes
  4. when the request url is empty, route tree crashes
  5. can’t click the link to run the task in adminui
  6. FASTCGI restart didn’t delete the unix Socket file

Beego 1.4.2

New Features:

  1. Added SQL Constructor inspired by ZEND ORM.
  2. Added GetInt(), GetInt8(), GetInt16(), GetInt32(), GetInt64() for Controller.
  3. Improved the logging. Added FilterHandler for filter logging output.
  4. Static folder supports index.html. Automatically adding / for static folders.
  5. flash supports success and set methods.
  6. Config for ignoring case for routers: RouterCaseSensitive. Case sensitive by default.
  7. Configs load based on environment: beego.AppConfig.String("myvar") return 456 on dev mode and return 123 on the other modes.

    runmode = dev
    myvar = 123
    myvar = 456

  8. Added include for ini config files:

    appname = btest
    include b.conf

  9. Added paginator utils.

  10. Added BEEGO_RUNMODE environment variable. You can change the application mode by changing this environment variable.

  11. Added Json function for fetching statistics in toolbox.

  12. Attachements support for mail utils.

  13. Turn on fastcgi by standard IO.

  14. Using SETEX command to support the old version redis in redis Session engine.

  15. RenderForm supports html id and class by using id and class tag.

  16. ini config files support BOM head.

  17. Added new Session engine ledis.

  18. Improved file uploading in httplib. Supporting extremely large files by using io.Pipe.

  19. Binding to TCP4 address by default. It will bind to ipv6 in GO. Added config variable ListenTCP4.

  20. off/on/yes/no/10 will parse to bool in form rendering. Support time format.

  21. Simplify the generating of SeesionID. Using golang buildin rand function other than hmac_sha1.


  1. XSRF verification failure while PUT and DELETE cased by lowercased _method
  2. No error message returned while initialize the cache by StartAndGC
  3. Can’t set User-Agent in httplib
  4. Improved DelStaticPath
  5. Only finding files in the first static folder when using multiple static folders
  6. Filter functions can’t execute after AfterExec and FinishRouter
  7. Fixed uninitialized mime
  8. Wrong file name and line number in the log
  9. Can’t send the request while only uploading one file in httplib
  10. Improved the Abort output message. It couldn’t out undefined error message before.
  11. Fixed the issue that can’t add inner Filter while no out Filter set in the nested namespaces
  12. Router mapping error while router has multiple level parameters. #824
  13. The information lossing while having many namespaces for the commented router. #770
  14. urlfor function calling useless {{placeholder}} #759

Beego 1.4.1

New features:

  1. context.Input.Url get path info without domain scheme.
  2. Added plugin apiauth to simulate the AWS encrypted requests.
  3. Simplified the debug output for router info.
  4. Supportting pointer type in ORM.
  5. Added BasicAuth, cache for multiple requests


  1. Router . can’t be parsed

Beego 1.3.0

Hi guys! After the hard working for one month, we are so excited to release Beego 1.3.0. We brought many useful features. Upgrade notes

The brand new router system

We rewrote the router system to tree router. It improved the performance significantly and supported more formats.

For the routers below:


If the request is /user/astaxie, it will match fixed router which is the first one; If the request is /user/slene, it will match the second one. The register order doesn’t matter.

namespace is more elegant

namespace is designed for modular applications. It was using chain style similar to jQuery in previous version but gofmt can’t format it very well. Now we are using multi parameters style: (The chain style still works)

ns :=
        beego.NSGet("/:id", func(ctx *context.Context) {
        beego.NSGet("/:id", func(ctx *context.Context) {
        beego.NSGet("/:id", func(ctx *context.Context) {

For more information please check namespace

Annotation Router

type CMSController struct {

func (c *CMSController) URLMapping() {
    c.Mapping("StaticBlock", c.StaticBlock)
    c.Mapping("AllBlock", c.AllBlock)

// @router /staticblock/:key [get]
func (this *CMSController) StaticBlock() {


// @router /all/:key [get]
func (this *CMSController) AllBlock() {

Annotation Router

Automated API Document

Automated document is a very cool feature that I wish to have. Now it became real in Beego. As I said Beego will not only boost the development of API but also make the API easy to use for the user.

The API document can be generated by annotations automatically and can be tested online.

For more information please check Automated Document

config supports different Runmode

You can set configurations for different Runmode under their own sections. Beego will take the configurations of current Runmode by default. For example:

appname = beepkg
httpaddr = ""
httpport = 9090
runmode ="dev"
autorender = false
autorecover = false
viewspath = "myview"

httpport = 8080
httpport = 8088
httpport = 8888

The configurations above set up httpport for dev, prod and test environment. Beego will take httpport = 8080 for current runmode “dev”.

Support Two Way Authentication for SSL

config := tls.Config{
    ClientAuth: tls.RequireAndVerifyClientCert,
    Certificates: []tls.Certificate{cert},
    ClientCAs: pool,
config.Rand = rand.Reader

beego.BeeApp.Server.TLSConfig = &config

beego.Run supports parameter

beego.Run() Run on HttpPort by default



Increased XSRFKEY token from 15 characters to 32 characters.

Removed hot reload

Template function supports Config. Get Config value from Template easily.

{{config returnType key defaultValue}}

{{config "int" "httpport" 8080}}

httplib supports cookiejar. Thanks to curvesft

orm suports time format. If empty return nil other than 0000.00.00 Thanks to JessonChan

config module supports parsing a json array. Thanks to chrisport

bug fix

  • Fixed static folder infinite loop
  • Fixed typo

Beego 1.2.0

Hi guys! After one month of hard work, we released the new awesome version 1.2.0. Beego is the fastest Go framework in the latest Web Framework Benchmarks already though our goal is to make Beego the best and easiest framework to use. In this new release, we improved even more in both usability and performance which is closer to native Go.

New Features:

1. namespace Support

        Filter("before", auth).
        Get("/notallowed", func(ctx *context.Context) {
        Router("/version", &AdminController{}, "get:ShowAPIVersion").
        Router("/changepassword", &UserController{}).
            Filter("before", sentry).
            Get("/:id", func(ctx *context.Context) {

The code above supports the URL requests below:

GET       /v1/notallowed
GET       /v1/version
GET       /v1/changepassword
POST      /v1/changepassword
GET       /v1/shop/123

namespace also supports pre-filters, conditions checking and unlimited nested namespace

2. Supporting more flexible router modes

Custom functions from RESTful router

beego.Get(router, beego.FilterFunc)
beego.Post(router, beego.FilterFunc)
beego.Put(router, beego.FilterFunc)
beego.Head(router, beego.FilterFunc)
beego.Options(router, beego.FilterFunc)
beego.Delete(router, beego.FilterFunc)

beego.Get("/user", func(ctx *context.Context) {
    ctx.Output.Body([]byte("Get userlist"))

More flexible Handler

beego.Handler(router, http.Handler)

Integrating other services easily

import (

func init() {
    s := rpc.NewServer()
    s.RegisterCodec(json.NewCodec(), "application/json")
    s.RegisterService(new(HelloService), "")
    beego.Handler("/rpc", s)

3. Binding request parameters to object directly

For example: this request parameters

var id int
ctx.Input.Bind(&id, "id")  //id ==123

var isok bool
ctx.Input.Bind(&isok, "isok")  //isok ==true

var ft float64
ctx.Input.Bind(&ft, "ft")  //ft ==1.2

ol := make([]int, 0, 2)
ctx.Input.Bind(&ol, "ol")  //ol ==[1 2]

ul := make([]string, 0, 2)
ctx.Input.Bind(&ul, "ul")  //ul ==[str array]

user struct{Name}
ctx.Input.Bind(&user, "user")  //user =={Name:"astaxie"}

4. Optimized the form parsing flow and improved the performance

5. Added more testcases

6. Added links for admin monitoring module

7. supporting saving struct into session

8.httplib supports file upload interface

b.PostFile("uploadfile1", "httplib.pdf")
b.PostFile("uploadfile2", "httplib.txt")
str, err := b.String()
if err != nil {

httplib also supports custom protocol version

9. ORM supports all the unexport fields of struct

10. Enable XSRF in controller level. XSRF can only be controlled in the whole project level. However, you may want to have more control for XSRF, so we let you control it in Prepare function in controller level. Default is true which means using the global setting.

func (a *AdminController) Prepare(){
       a.EnableXSRF = false

11. controller supports ServeFormatted function which supports calling ServeJson or ServeXML based on the request’s Accept

12. session supports memcache engine

13. The Download function of Context supports custom download file name

Bug Fixes

  1. Fixed the bug that session’s Cookie engine can’t set expiring time
  2. Fixed the bug of saving and parsing flash data
  3. Fixed all the problems of go vet
  4. Fixed the bug of ParseFormOrMulitForm
  5. Fixed the bug that only POST can parse raw body. Now all the requests except GET and HEAD support raw body.
  6. Fixed the bug that config module can’t parse xml and yaml

Beego 1.1.4

This is an emergency release for solving a serious security problem. Please update to the latest version! By the way released all changes together.

  1. fixed a security problem. I will show the details in beego/ later.

  2. statifile move to new file.

  3. move dependence of the third libs,if you use this module in your application: session/cache/config, please import the submodule of the third libs:

    import (
       _ ""
  4. modify some functions to private.

  5. improve the FormParse.

released date: 2014-04-08

Beego 1.1.3

this is a hot fixed:

  1. console engine for logs.It will not run if there’s no config.

  2. Beego 1.1.2 support go run main.go, but if main.go bot abute the Beego’s project rule,use own AppConfigPath or not exist app.conf will panic.

  3. Beego 1.1.2 supports go test parse config,but actually when call TestBeegoInit still can’t parseconfig

released date: 2014-04-04

Beego 1.1.2

The improvements:

  1. Added ExceptMethodAppend fuction which supports filter out some functions while run autorouter
  2. Supporting user-defined FlashName, FlashSeperator
  3. ORM supports user-defined types such as type MyInt int
  4. Fixed validation module return user-defined validating messages
  5. Improved logs module, added Init processing errors. Changed some unnecessory public function to private
  6. Added PostgreSQL engine for session module
  7. logs module supports output caller filename and line number. Added EnableFuncCallDepth function, closed by default.
  8. Fixed bugs of Cookie engine in session module
  9. Improved the error message for templates parsing error
  10. Allowing modifing Context by Filter to skip Beego’s routering rules and using uder-defined routering rules. Added parameters RunController and RunMethod
  11. Supporting to run Beego APP by using go run main.go
  12. Supporting to run test cases by using go test. Added TestBeegoInit function.

released date: 2014-04-03

Beego 1.1.1

Added some new features and fixed some bugs in this release.

  1. File engine can’t delete file in session module which will raise reading failure.
  2. File cache can’t read struct. Improved god automating register
  3. New couchbase engine for session module
  4. httplib supports transport and proxy
  5. Improved the Cookie function in context which support httponly by default as well as some other default parameters.
  6. Improved validation module to support different cellphone No.
  7. Made getstrings function to as same as getstring which doesn’t need parseform
  8. Redis engine in session module will return error while connection failure
  9. Fixed the bug of unable to add GroupRouters
  10. Fixed the bugs for multiple static files, routes matching bug and display the static folder automatically
  11. Added GetDB to get connected *sql.DB in ORM
  12. Added ResetModelCache for ORM to reset the struct which has already registered the cache in order to write tests easily
  13. Supporting between in ORM
  14. Supporting sql.Null* type in ORM
  15. Modified auto_now_add which will skip time setting if there is default value.

released date: 2014-03-12

Beego 1.1.0

Added some new features and fixed some bugs in this release.

New features

  1. Supporting AddAPPStartHook function
  2. Supporting plugin mode; Supporting AddGroupRouter for configuring plugin routes.
  3. Response supporting HiJacker interface
  4. AddFilter supports batch matching
  5. Refactored session module, supporting Cookie engine
  6. Performance benchmark for ORM
  7. Added strings interface for config which allows configuration
  8. Supporting template render control in controller level
  9. Added basicauth plugin which can implement authentication easily
  10. #436 insert multiple objects
  11. #384 query map to struct


  1. Fixed the bug of FileCache
  2. Fixed the import lib of websocket
  3. Changed http status from 200 to 500 when there are internal error.
  4. gmfim map in memzipfile.go file should use some synchronization mechanism (for example sync.RWMutex) otherwise it errors sometimes.
  5. Fixed #440 on_delete bug that not getting delted automatically
  6. Fixed #441 timezone bug

released date: 2014-02-10

Beego 1.0 release

After four months code refactoring, we released the first stable version of Beego. We did a lot of refactoring and improved a lot in detail. Here is the list of the main improvements:

  1. Modular design. Right now Beego is a light weight assembling framework with eight powerful stand alone modules including cache, config, logs, sessions, httplibs, toolbox, orm and context. It might have more in the future. You can use all of these stand alone modules in your other applications directly no matter it’s web applications or any other applications such as web games and mobile games.

  2. Supervisor module. In the real world engineering, after the deployment of the application, we need to do many kinds of statistics and analytics for the application such as QPS statistics, GC analytics, memory and CPU monitoring and so on. When the live issue happends we also want to debug and profile our application on live. All of these real world engineering features are included in Beego. You can enable the supervisor module in Beego and visit it from default port 8088.

  3. Detailed document. We rewritten all the document. We improved the document based on many advices from the users. To make it communicate easier for different language speakers, now the comments of the document in each language are separated.

  4. Demos. We provided three examples, chat room, url shortener and todo list. You can understand and use Beego easier and faster by learning the demos.

  5. Redesigned Beego website. Nice people from Beego community helped Beego for logo design and website design.

  6. More and more users. We listed our typical users in our homepage. They are all big companies and they are using Beego for their products already. Beego already tested by those live applications.

  7. Growing active communities. There are more than 390 issues on github, more than 36 contributors and more than 700 commits. Google groups is also growing.

  8. More and more applications in Beego. There are some open source applications as well. E.g.: CMS system: and admin system:

  9. Powerful assistance tools. bee is used to assist the development of Beego applications. It can create, compile, package the Beego application easily.

released date: 2013-12-19

comments powered by Disqus