Gorm: AutoMigrate: using unaddressable value

Created on 19 Mar 2015  路  2Comments  路  Source: go-gorm/gorm

Since updating to the newest version of go and gorm, I gate strange errors on AutoMigrate. When I execute the following code:

package main

import (
    "github.com/jinzhu/gorm"
    _ "github.com/go-sql-driver/mysql"
)

type Lorem struct {
    Id    int
    Name  string
}

func main() {
    db, _ := gorm.Open("mysql", "myproject:myproject@/myproject?charset=utf8&parseTime=True")

    db.AutoMigrate(Lorem{})
}

I get the following error:

mygopath/myproject/main.go:16 using unaddressable value

Is there anything I do wrong here?

Thanks,
daseinhorn

Most helpful comment

 db.AutoMigrate(&Lorem{})

All 2 comments

 db.AutoMigrate(&Lorem{})

I knew it was something that simple. Sorry. Just overlooked it completely!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kumarsiva07 picture kumarsiva07  路  3Comments

superwf picture superwf  路  3Comments

easonlin404 picture easonlin404  路  3Comments

Quentin-M picture Quentin-M  路  3Comments

satb picture satb  路  3Comments