0

The behaviour of liteIDE is bit strange. I did go get the mgo.v2 packages and the gopath is correct. The autocomplete works when i manually put the import statement "gopkg.in/mgo.v2" . I get the functions Dial,.. of mgo . But after pressing "ctrl + s" the import goes away though i have mgo functions used in my code.. Wondering if its a bug in liteIDE.

I am using liteIDE version 24.2

    package main

    import (
        "fmt"
        "log"

        "gopkg.in/mgo.v2/bson"
    )

    type Person struct {
        Name  string
        Phone string
    }

    func main() {
        session, err := mgo.Dial("server1.example.com,server2.example.com")
        if err != nil {
            panic(err)
        }
        defer session.Close()

        // Optional. Switch the session to a monotonic behavior.
        session.SetMode(mgo.Monotonic, true)

        c := session.DB("test").C("people")
        err = c.Insert(&Person{"Ale", "+55 53 8116 9639"},
            &Person{"Cla", "+55 53 8402 8510"})
        if err != nil {
            log.Fatal(err)
        }

        result := Person{}
        err = c.Find(bson.M{"name": "Ale"}).One(&result)
        if err != nil {
            log.Fatal(err)
        }

        fmt.Println("Phone:", result.Phone)
    }
lennon310
  • 12,503
  • 11
  • 43
  • 61
charan
  • 71
  • 6
  • 2
    if you only took the time to read their change log https://github.com/visualfc/liteide/blob/master/liteidex/deploy/welcome/en/changes.md -- also x24.3 is out with many fixes – ymg Nov 16 '14 at 05:33

1 Answers1

0

Yes it works in 24.3 , apparently this is a bug in 24.2.

charan
  • 71
  • 6