I was developing a Golang application on Windows using the getlantern/systray library to implement a system tray functionality. Upon switching to a Mac for development, I encountered an error. Is there a solution to resolve this issue?
func main() {
onExit := func() {
os.Exit(0)
}
go func() {
systray.Run(onReady, onExit)
}()
func onReady() {
systray.SetIcon(iconData)
systray.SetTitle("Connectapp")
systray.SetTooltip("Connectapp")
mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
go func() {
<-mQuit.ClickedCh
systray.Quit()
}()
}
When running 'go build' in Visual Studio Code on Windows, I encountered no errors. However, when working on macOS in Visual Studio Code, an error occurred, as shown below:
# github.com/getlantern/systray
../../../../go/pkg/mod/github.com/getlantern/[email protected]/systray.go:78:2: undefined: nativeLoop
../../../../go/pkg/mod/github.com/getlantern/[email protected]/systray.go:106:2: undefined: registerSystray
../../../../go/pkg/mod/github.com/getlantern/[email protected]/systray.go:111:14: undefined: quit
../../../../go/pkg/mod/github.com/getlantern/[email protected]/systray.go:136:2: undefined: addSeparator
../../../../go/pkg/mod/github.com/getlantern/[email protected]/systray.go:190:2: undefined: hideMenuItem
../../../../go/pkg/mod/github.com/getlantern/[email protected]/systray.go:195:2: undefined: showMenuItem
../../../../go/pkg/mod/github.com/getlantern/[email protected]/systray.go:220:2: undefined: addOrUpdateMenuItem