Under Mac OS X I did a brew install go. I also downloaded the Go IntelliJ IDE from here
http://go-ide.com/2011/08/09/goide_release_1_0_darwin.html
The following program compiles and runs fine from the command line, but if I use the GO IntelliJ IDE it gives an error:
can't find import: math/rand
import time seems ok, but Duration and time.Millisecond are undefined. If I remove these things and just run the "Hello World version" the program compiles and runs fine.
/**
* Created by IntelliJ IDEA.
* User: idf
* Date: 4/2/14
* Time: 1:59 PM
* To change this template use File | Settings | File Templates.
*/
package main
import (
"fmt"
"math/rand" /* causes problems */
"time"
)
func main() {
sleep := time.Duration(200) /* error: undefined: time.Duration */
time.Sleep(sleep * time.Millisecond) /* error: undefined: time.Millisecond */
rand.Intn(1000)
fmt.Println("Hello World")
}