Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues installing and setting up server. #48

Closed
harshjari opened this issue Mar 12, 2014 · 7 comments
Closed

Issues installing and setting up server. #48

harshjari opened this issue Mar 12, 2014 · 7 comments

Comments

@harshjari
Copy link

Hi,
Thanks for the awesome freegeoip. I am attempting to run a server of my own so that I won't have to affect your servers.
I have never used go before so please bear with my lack of knowledge.
The process I used is:
install go: sudo apt-get install golang
install other reqs: sudo apt-get install build-essential libsqlite3-dev pkg-config
get your git code: sudo go get github.com/fiorix/freegeoip
attempting to build:
cd /usr/lib/go/src/pkg/github.com/fiorix/freegeoip
and then: go build

First I ran into:
/usr/lib/go/src/pkg/github.com/fiorix/go-redis/redis/redis.go:265: function ends without a return statement

After fixing the above by moving the return from the else outside the else statement, I get the following issue(while attempting go run):

/usr/lib/go/src/pkg/github.com/fiorix/freegeoip/freegeoip.go:273: enc.Indent undefined (type *xml.Encoder has no field or method Indent)

I hope you can help me fix the issue.
Thanks!

@fiorix
Copy link
Owner

fiorix commented Mar 12, 2014

Ubuntu's golang package is very old and no longer supported. Just download the latest binary tarball from golang.org and unpack in /opt/go and set GOROOT=/opt/go and add $GOROOT/bin to the path. Then go build should work fine.

Sent from the future

On Mar 12, 2014, at 5:18 PM, harshjari notifications@github.com wrote:

Hi,
Thanks for the awesome freegeoip. I am attempting to run a server of my own so that I won't have to affect your servers.
I have never used go before so please bear with my lack of knowledge.
The process I used is:
install go: sudo apt-get install golang
install other reqs: apt-get install build-essential libsqlite3-dev pkg-config
get your git code: sudo go get github.com/fiorix/freegeoip
attempting to build:
cd /usr/lib/go/src/pkg/github.com/fiorix/freegeoip
and then: go build

First I ran into:
/usr/lib/go/src/pkg/github.com/fiorix/go-redis/redis/redis.go:265: function ends without a return statement

After fixing the above by moving the return from the else outside the else statement, I get the following issue(while attempting go run):

/usr/lib/go/src/pkg/github.com/fiorix/freegeoip/freegeoip.go:273: enc.Indent undefined (type *xml.Encoder has no field or method Indent)

I hope you can help me fix the issue.
Thanks!


Reply to this email directly or view it on GitHub.

@harshjari
Copy link
Author

Thanks for the quick reply. I attempted your suggestion but it still fails:
export GOROOT=/opt/go
export GOPATH=/usr/lib/go
export PATH=$PATH:$GOROOT/bin

sudo go get github.com/fiorix/freegeoip - this finishes but i get a lot of these errors:
imports database/sql: unrecognized import path "database/sql"
imports encoding/binary: unrecognized import path "encoding/binary"
and so on.

But if i push ahead and try: go build
I get:
quota.go:13:2: cannot find package "github.com/fiorix/go-redis/redis" in any of:
/opt/go/src/pkg/github.com/fiorix/go-redis/redis (from $GOROOT)
/usr/lib/go/src/github.com/fiorix/go-redis/redis (from $GOPATH)
freegeoip.go:29:2: cannot find package "github.com/fiorix/go-web/httpxtra" in any of:
/opt/go/src/pkg/github.com/fiorix/go-web/httpxtra (from $GOROOT)
/usr/lib/go/src/github.com/fiorix/go-web/httpxtra (from $GOPATH)
freegeoip.go:31:2: cannot find package "github.com/mattn/go-sqlite3" in any of:
/opt/go/src/pkg/github.com/mattn/go-sqlite3 (from $GOROOT)
/usr/lib/go/src/github.com/mattn/go-sqlite3 (from $GOPATH)

Thanks!

@harshjari
Copy link
Author

I think i've narrowed it down but I don't know how to fix it the right way. it tries to find "github.com/fiorix/go-redis/redis" in "/usr/lib/go/src/"
BUT it should be trying it in --------- "/usr/lib/go/src/PKG/"
How do you recommend I fix this issue?
Also any suggestions about how to fix the unrecognized import paths?
Thanks

@fiorix
Copy link
Owner

fiorix commented Mar 13, 2014

Just do go get without sudo and it'll work. Then go build.

Sent from the future

On Mar 13, 2014, at 3:51 PM, harshjari notifications@github.com wrote:

Thanks for the quick reply. I attempted your suggestion but it still fails:
export GOROOT=/opt/go
export GOPATH=/usr/lib/go
export PATH=$PATH:$GOROOT/bin

sudo go get github.com/fiorix/freegeoip - this finishes but i get a lot of these errors:
imports database/sql: unrecognized import path "database/sql"
imports encoding/binary: unrecognized import path "encoding/binary"
and so on.

But if i push ahead and try: go build
I get:
quota.go:13:2: cannot find package "github.com/fiorix/go-redis/redis" in any of:
/opt/go/src/pkg/github.com/fiorix/go-redis/redis (from $GOROOT)
/usr/lib/go/src/github.com/fiorix/go-redis/redis (from $GOPATH)
freegeoip.go:29:2: cannot find package "github.com/fiorix/go-web/httpxtra" in any of:
/opt/go/src/pkg/github.com/fiorix/go-web/httpxtra (from $GOROOT)
/usr/lib/go/src/github.com/fiorix/go-web/httpxtra (from $GOPATH)
freegeoip.go:31:2: cannot find package "github.com/mattn/go-sqlite3" in any of:
/opt/go/src/pkg/github.com/mattn/go-sqlite3 (from $GOROOT)
/usr/lib/go/src/github.com/mattn/go-sqlite3 (from $GOPATH)

Thanks!


Reply to this email directly or view it on GitHub.

@harshjari
Copy link
Author

unfortunately i get
mkdir /usr/lib/go: permission denied

Edit: I changed the go path to the home directory /go and then it works (as expected since my user doesnt have access to /usr/lib/)

only error i get is:
github.com/mattn/go-sqlite3
/opt/go/pkg/tool/linux_amd64/6c: unknown flag -FVw

I am on ubuntu 12.04 and Im using: http://code.google.com/p/go/downloads/detail?name=go1.2.1.linux-amd64.tar.gz&can=2&q=

Edit2:
So it seems I didnt clear out all the other go packages when i did aptget remove golang.
I just removed them and retried running it.
It built successfully. Sorry for the confusion and thanks a lot for your help. Im gonna try and run it and if it works, i'll close this issue.

@harshjari
Copy link
Author

It runs successfully. Thanks a lot.
I have one last question that I'd be very happy if you could answer:
Does the server have the same 10000 query api usage quota that the freegeoip website does? If so,
how would I disable it?
Thanks, again!

Edit: freegeoip.conf is the answer to my question.
Thanks!

@fiorix
Copy link
Owner

fiorix commented Mar 14, 2014

Yeah, you got it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants