I'm getting the following error when I execute my tests. This was working previously. Not sure what I need to do in order to fix this error.
golang.org/x/crypto/ripemd160/ripemd160block.go:12:2: cannot find package "math/bits" in any of:
/usr/local/Cellar/go@1.8/1.8.7/libexec/src/math/bits (from $GOROOT)
Go 1.9 includes a new package, math/bits, with optimized implementations for manipulating bits. On most architectures, functions in this package are additionally recognized by the compiler and treated as intrinsics for additional performance.
You need Go version 1.9 or later.
I have several versions of Go installed from source in my $HOME
directory: ~/go1.4
, ~/go1.8
, ~/go1.9
, ~/go1.10
, and ~/go
(devel). Copy the src/math/bits
folder from go1.9 or later to go1.8. From go1.8/src
run go1.8 install -v math/bits
.
go1.8
:
#!/bin/sh
# $HOME/bin/go1.8
export GOARCH=amd64
export GOOS=linux
export GOROOT=$HOME/go1.8
export GOBIN=$GOROOT/bin
exec $GOBIN/go "$@"
Output:
$ cd ~/go1.8/src
$ go1.8 install -v math/bits
math/bits
For example,
package main
import (
"fmt"
"math/bits"
)
func main() {
fmt.Println(bits.UintSize)
}
Output:
$ go1.8 run bits.go
64
You need to copy package "math/bits" for you gopath. An way is:
<goprojectpath>/src/math
(cp -r ...)
from <goroot_1.10+>/src/math/bits
to <goprojectpath>/src/math
govendor add +external
Or install new golang version to 1.10+.