3

Not familiar with Go but I'm trying to set up freegeoip and I keep getting this error when I try to build it:

go get github.com/fiorix/freegeoip
cd ~/go/src/github.com/fiorix/freegeoip
go build

../../oschwald/maxminddb-golang/decoder.go:4:2: import "bytes": cannot find package
db.go:8:2: import "compress/gzip": cannot find package
../../oschwald/maxminddb-golang/decoder.go:5:2: import "encoding/binary": cannot find package
encoder.go:8:2: import "encoding/csv": cannot find package
../../robertkrimen/otto/script.go:5:2: import "encoding/gob": cannot find package
../../robertkrimen/otto/builtin.go:4:2: import "encoding/hex": cannot find package
encoder.go:9:2: import "encoding/json": cannot find package
encoder.go:10:2: import "encoding/xml": cannot find package
db.go:9:2: import "errors": cannot find package
db.go:10:2: import "fmt": cannot find package
../../robertkrimen/otto/dbg/dbg.go:62:2: import "io": cannot find package
../../robertkrimen/otto/parser/parser.go:40:2: import "io/ioutil": cannot find package
../../robertkrimen/otto/dbg/dbg.go:63:2: import "log": cannot find package
../../robertkrimen/otto/builtin.go:5:2: import "math": cannot find package
../../oschwald/maxminddb-golang/decoder.go:7:2: import "math/big": cannot find package
../../robertkrimen/otto/builtin_math.go:5:2: import "math/rand": cannot find package
../../oschwald/maxminddb-golang/reader.go:7:2: import "net": cannot find package
db.go:14:2: import "net/http": cannot find package
../../robertkrimen/otto/builtin.go:6:2: import "net/url": cannot find package
../../howeyc/fsnotify/fsnotify_linux.go:12:2: import "os": cannot find package
db.go:16:2: import "path/filepath": cannot find package
../../oschwald/maxminddb-golang/decoder.go:8:2: import "reflect": cannot find package
../../robertkrimen/otto/dbg/dbg.go:65:2: import "regexp": cannot find package
package github.com/fiorix/freegeoip
    imports runtime: import "runtime": cannot find package
../../robertkrimen/otto/parser/error.go:5:2: import "sort": cannot find package
../../robertkrimen/otto/token/token.go:5:2: import "strconv": cannot find package
../../howeyc/fsnotify/fsnotify_linux.go:13:2: import "strings": cannot find package
../../howeyc/fsnotify/fsnotify_linux.go:14:2: import "sync": cannot find package
../../howeyc/fsnotify/fsnotify_linux.go:15:2: import "syscall": cannot find package
../../robertkrimen/otto/builtin_date.go:5:2: import "time": cannot find package
../../robertkrimen/otto/dbg/dbg.go:68:2: import "unicode": cannot find package
../../robertkrimen/otto/builtin.go:10:2: import "unicode/utf16": cannot find package
../../robertkrimen/otto/parser/lexer.go:11:2: import "unicode/utf8": cannot find package
../../howeyc/fsnotify/fsnotify_linux.go:16:2: import "unsafe": cannot find package

EDIT: My GOPATH & GOROOT are:

GOROOT=/usr/local/go
GOPATH=$HOME/go
Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58
jwerre
  • 9,179
  • 9
  • 60
  • 69
  • 1
    What is the output of `go version`? How did you install go to `/usr/local/go` ? Do you get the same error if you unset `GOROOT` temporarily? – phihag Dec 04 '14 at 23:43
  • `sudo apt-get install golang` to and install `go version go1` – jwerre Dec 04 '14 at 23:45
  • Same error when I unset `GOROOT`. – jwerre Dec 05 '14 at 00:02
  • 4
    Something doesn't add up. You used apt-get to install go, yet you are using /usr/local as base for the GOROOT ? This : https://packages.debian.org/wheezy/amd64/golang-go/filelist tends to imply that you should use /usr/lib/go instead. – SirDarius Dec 05 '14 at 00:10
  • strange... so if I do `sudo go build` I get `/usr/lib/go/src/pkg/github.com/oschwald/maxminddb-golang/decoder.go:277: function ends without a return statement /usr/lib/go/src/pkg/github.com/oschwald/maxminddb-golang/decoder.go:277: too many errors` which is the same message I get if change the GOROOT to `/usr/lib/go` – jwerre Dec 05 '14 at 00:21
  • 2
    How did the source code for maxminddb find itself under the GOROOT ? It should be under the GOPATH instead. – SirDarius Dec 05 '14 at 00:29

0 Answers0