go version, using1.23.6for this proof of concept
-
If different version, see https://go.dev/doc/manage-install to
go install golang.org/dl/go1.23.6@latest -
then download
go1.23.6 download -
go1.23.6 env GOROOTshould show version downloaded, however if wego versionit may not be correct. Checkwhich goto determine. -
Need be update your
.bashrcor.zshrcandsource ~/.zshrcafter the changes:export GOROOT=/Users/zion/sdk/go1.23.6 export GOPATH=$HOME/go # in home dir create dir called go and where everything is gonna go in there. # export PATH=$PATH:$GOPATH/bin # Adding to my path and path is stuff I can run from my term and concatinating in go/bin all in my path to be useable export PATH=$GOROOT/bin:$PATH:$GOPATH/bin # Modified to include GOROOT/bin first -
Now
which goandgo versionshould reflect 1.23.6 which we are utilizing, though feel free to attempt with new Go versions. -
To summarize: The PATH setup export PATH=$GOROOT/bin:$PATH:$GOPATH/bin maintains all the functionality you currently have, while just ensuring you're using the new Go version. Here's what each part does:
$GOROOT/bin - This adds your new Go binary location
$PATH - This keeps all your existing PATH entries
$GOPATH/bin - This maintains your current setup that lets you run Go programs from anywhere
The order matters here - we put $GOROOT/bin first so it takes precedence for the go command itself, but everything else in your PATH (including your GOPATH/bin) stays exactly the same. This means:
You can still run go commands from any directory
Your installed Go programs will still be accessible from anywhere
Your existing Go projects and workspace structure stay the same
The only thing that changes is which version of Go you're using - everything else about your setup remains functional just as it is now.
- Inside the directory,
go mod init go-geo-pocto initialize the project before getting tooling - Obtain gorilla mux for routing, uber h3 for geospatial indexing, IP-API , & spherand for generating random points on a sphere.
go get -u github.com/gorilla/mux
go get -u github.com/uber/h3-go
go get -u github.com/mmcloughlin/spherand
-
After completing this POC, demo by
go run main.goand navigate tohttp://localhost:8080to see location and a list of recommended POIs.Expected outputs: