I'm trying to install the context
package in golang, which I did like this :
go get golang.org/x/net/context
But when I do an import "context"
, I still get the following error :
cannot find package "context" in any of:
/usr/lib/go-1.6/src/context (from $GOROOT)
/home/saurabh/work/src/context (from $GOPATH)
Can anyone suggest how to install this package ? I'm currently using version go1.6.2
.
change import "context"
to import "golang.org/x/net/context"
.
but after go 1.7 you can use import "context"
, as it had become a standard library.
Go 1.7 moves the golang.org/x/net/context package into the standard library as context.
see 1.7 release notes: https://golang.org/doc/go1.7#context
I faced similar issue , below are the steps to fix:
Download the latest version https://golang.org/doc/install?download=go1.9.2.linux-arm64.tar.gz
Extract the tar to /usr/local/ .
Use Command -> tar -xzvf go1.9.2.linux-arm64.tar.gz -C /usr/local
sudo rm /usr/bin/go
sudo ln -s /usr/local/go/bin/go /usr/bin/go
Reference: https://github.com/DieterReuter/arm64-docker-builder/issues/7
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With