Commit Graph

4 Commits

Author SHA1 Message Date
Ivan Kozlovic
f805f23d6e Travis updates
- Add Go 1.17
- Fix go fmt from Go 1.17 (build directives)
- Download version of misspell and staticcheck instead of doing
"go get" since current staticcheck would be broken without go.mod

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-11-15 17:23:08 -07:00
Phil Pennock
bc6c433142 FreeBSD fixes: %cpu scale; no-cgo for amd64
It would be convenient if we did not need to use cgo to compile for
FreeBSD for common architectures, allowing builds to be generated in
Linux CI flows.

The sysctl interface uses offsets which can vary by build architecture,
so doing this in the general case without cgo is not realistic.  But we
can front-load the C work to get the offsets for a given architecture,
then use encoding/binary at run-time.

While doing this, I saw that the existing FreeBSD code was
mis-calculating `%cpu` by converting the `fixpt_t` scaled int straight
to a double without dividing by the scaling factor, so we also fix for
all other architectures by introducing a division by `FSCALE`.

The offsets-emitting code is in `freebsd.txt`, with the filename chosen
to keep the Go toolchain from picking it up and trying to compile.

The result is unsafe-free cgo-free builds for FreeBSD/amd64.
2020-11-24 23:04:50 -05:00
Derek Collison
00901acc78 Update license to Apache 2 2018-03-15 22:31:07 -07:00
Derek Collison
5bea74c2ed Rename and move some things around 2016-04-21 09:33:26 -07:00