Undefined: syscall.Kill on Windows - go

I'm using eaburns/Watch library on a windows machine, but when trying to get the package with go get github.com/eaburns/Watch I get the following errors:
main.go:159: undefined: syscall.Kill
main.go:169: undefined: syscall.Wait4
main.go:169: undefined: syscall.WNOHANG
Any reason why this happens only on windows computers? How to fix this?

The syscall package is dependent on the operating system. syscall.Kill is for Unix/Linux/Mac systems, not Windows.
Use godoc syscall to get information on the syscall package for your system. This is explained in the Overview section in the package documentation:
https://golang.org/pkg/syscall/

Related

underfined function error in go :jmpToFunctionValue

While running main.go getting this error in monkey file and function is given below.
bou.ke/monkey
../go/pkg/mod/bou.ke/monkey#v1.0.2/replace.go:24:14: undefined: jmpToFunctionValue
Anyone help me with that?
I also face this error while using mac M1.
could you check the goarch var in go env? if you got arm64, you need to change it to amd64 using this command
go env -w GOARCH=amd64
it works for me

Trouble with go get install for mcumgr

I am trying to install MCUMgr on MACos. Here is a link for mcumgr: https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr.html
I install the Go Programming Language and enter this command:
go install github.com/apache/mynewt-mcumgr-cli/mcumgr#latest
Upon doing this I get the following error:
go/pkg/mod/golang.org/x/sys#v0.0.0-20200223170610-d5e6a3e2c0ae/unix/zsyscall_darwin_amd64.go:28:3: //go:linkname must refer to declared function or variable
I then googled and found the following from stackoverflow: Go 1.18 build error on Mac: "unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable"
This gives me the following error:
go: golang.org/x/sys: unrecognized import path "golang.org/x": parse https://golang.org/x?go-get=1: no go-import meta tags ()
I am stuck right now on how to install MCUMgr for MACos and wondering if someone has previously had the same issues?
I used go 1.17 instead and used:
go get github.com/apache/mynewt-mcumgr-cli/mcumgr
Then into the bin folder where it is installed use sudo ./mcumgr to run.

go get fyne/io/driver/gl#v1.0.1 unrecognized import path

Trying to follow the installation guide here and most of the process is working. I'm having an issue with building it however.
When trying to build I'm getting this message:
C:...\gameboy.live>go build -o gbdotlive main.go
......\go\pkg\mod\fyne.io\fyne#v1.0.1\driver\gl\gl.go:20:2: missing go.sum entry for module providing package github.com/goki/freetype (imported by fyne.io/fyne/driver/gl); to add:
go get fyne.io/fyne/driver/gl#v1.0.1
Running the suggested command however raises another prompt:
C:...\gameboy.live>go get fyne.io/driver/gl#v1.0.1
go get fyne.io/driver/gl#v1.0.1: unrecognized import path "fyne.io/driver/gl": reading https://fyne.io/driver/gl?go-get=1: 404 Not Found
I've tried going for the version 1.4.3 driver too which raises a different error:
C:...\gameboy.live>go get fyne.io/fyne/gl#v1.4.3
go get: module fyne.io/fyne#v1.4.3 found, but does not contain package fyne.io/fyne/gl
Anybody familiar with this issue? FYI I'm on Windows and have MinGw installed already.
Just run go mod tidy before exec go build -o gbdotlive main.go.Have a try.

Unexplained errors when using "go get"

I'm using go 1.9 on OS X 10.12.6. I was attempting to "go get" github.com/maxbrunsfeld/counterfeiter, and was presented with the following cryptic errors:
% go get github.com/maxbrunsfeld/counterfeiter
# golang.org/x/sys/unix
code/go/src/golang.org/x/sys/unix/dirent.go:68:17: undefined: direntReclen
code/go/src/golang.org/x/sys/unix/dirent.go:74:14: undefined: direntIno
code/go/src/golang.org/x/sys/unix/dirent.go:81:24: constant -1000000000 overflows uint64
code/go/src/golang.org/x/sys/unix/dirent.go:81:41: undefined: Dirent
code/go/src/golang.org/x/sys/unix/dirent.go:82:17: undefined: direntNamlen
code/go/src/golang.org/x/sys/unix/flock.go:13:30: undefined: SYS_FCNTL
code/go/src/golang.org/x/sys/unix/flock.go:16:42: undefined: Flock_t
code/go/src/golang.org/x/sys/unix/flock.go:17:17: undefined: Syscall
I also attempted to go get with -u and -v, and while verbose mode provides some more information, none is really relevant to the errors seen here. Has anyone seen anything like this before?
Solved the same issue with just GOOS=linux GOARCH=amd64 go get ...

syscall variables undefined

When trying to build the following program on my Mac I get a build error: undefined: syscall.TCPInfo even though that variable is clearly documented http://golang.org/pkg/syscall/#TCPInfo
package main
import "syscall"
func main() {
_ = syscall.TCPInfo{}
}
Here is my go tool version.
$ go version
go version go1.3 darwin/amd64
I thought this might be an issue a lack of OS support so I tried it on http://play.golang.org, but it looks like many documented variables are just randomly missing from the syscall package: http://play.golang.org/p/w3Uk6NaZVy
Am I missing something?
The variable specified inside syscall are OS dependent.
you can add a suffix to the file to specify which os they should be built for:
// +build linux,386 darwin,!cgo
So you can use specific syscall flags for each OS.

Resources