wfarr / goenv

You know, rbenv but for go.
MIT License
111 stars 36 forks source link

Set GOROOT. #1

Closed spraints closed 11 years ago

spraints commented 11 years ago

Before:

$ cat > example.go
package main
import "fmt"
func main() {
  fmt.Printf("Hi!\n")
}
$ go run example.go
example.go:2:8: cannot find package "fmt" in any of:
        /usr/local/go/src/pkg/fmt (from $GOROOT)
        ($GOPATH not set)
package runtime: cannot find package "runtime" in any of:
        /usr/local/go/src/pkg/runtime (from $GOROOT)
        ($GOPATH not set)
$ GOROOT=$GOENV_ROOT/versions/$(goenv version) go run example.go
Hi!

After:

$ cat > example.go
package main
import "fmt"
func main() {
  fmt.Printf("Hi!\n")
}
$ go run example.go
Hi!
technoweenie commented 11 years ago

:sparkles:

jchenry commented 11 years ago

:thumbsup: this just bit me using boxen.

aroben commented 11 years ago

Yessssss.

lstoll commented 11 years ago

:+1: same, this kind of stuff bit me in the ass:

lstoll ~/src/go/src/hangpit $ go get
package fmt: unrecognized import path "fmt"
package net/http: unrecognized import path "net/http"
package os: unrecognized import path "os"
package runtime: unrecognized import path "runtime"

but this solved it.

spraints commented 11 years ago

@wfarr - can you merge this and tag the next release? It would be :sparkles: to get this into boxen, too. If it'll help, I can make PRs to get it there.

wfarr commented 11 years ago

'grats @spraints , you are now a maintainer

spraints commented 11 years ago

:metal: