can't find import go-gtk - go

I've been playing around with Google Go, I love the power behind it and decided to try out some libraries. I tried using goinstall to install github.com/mattn/go-gtk/gtk but when I try to compile an example I'm getting:
can't find import: github.com/mattn/go-gtk/gtk
I've heard that others have problems with goinstall, is there anything I can do to fix this? I also saw that some people fixed this by putting the path as something like github.com/mattn/go-gtk/gtk/gtk.so but it's still not working for me.

Use:
go install github.com/mattn/go-gtk/gtk
and it will download and install this library in $GOPATH/src

Use following command to install necessary packages
go get github.com/mattn/go-gtk

Related

trouble installing "gorilla/mux" in golang

So I installed gorilla/mux to use it for my API by typing this code on terminal
go get -u github.com/gorilla/mux
And since it didn't return any errors (nor any texts) I thought the install was successful. But When I started to use "mux. "something, vscode showed that the name "mux" is not declared. Does anyone had any similar experience or know how to solve the problem? Thanks in advance.
(Using go1.18.3)
Your project doesn't have go.sum file.
Run go mod tidy and you will be good to go.

Chaosmonkey Go Package Install

I have been trying to install chaosmonkey following the instruction from here using go
However, I have not been able to successfully resolve the issue for the past day. I keep getting the below error and if I try installing other packages using go get, it install it without any issue so I believe my path is correct.
go: downloading github.com/netflix/chaosmonkey v2.0.2+incompatible
go get: module github.com/netflix/chaosmonkey#v2.0.2 found (v2.0.2+incompatible), but does not contain package github.com/netflix/chaosmonkey/cmd/chaosmonkey
There is not much information on the internet and any help would be appreciated!

Llattice diamond programmer-tool

install Lattice Diamond 3.10 on my computer with Manjaro 17.1 and everything works correctly just because of a problem. The programming tool does not work, when I try to execute it I get a window with a message:
"can not load library:
/usr/local/diamond/3.10_x64/bin/lin64/toolapps/libdvmapp.so:
(libusb-0.1.so.4: the shared object file can not be opened: the file
does not exist or the directory)"
already downloaded and I put the library in the corresponding directory but still does not let me run it
Any suggestions to solve it, I would appreciate it very much
Thank you
I had to install the following libraries:
libusb 1.0.21-2
libgusb 0.2.11-1
libusb-compat 0.1.5-1
libusbmuxd 1.0.10+13dc724e70-1
And the programming tool works
I already had all of the dependencies listed by Cristian in place. I had to install libusb-dev and it worked.
sudo apt install libusb-dev

I can't seem to get rdkafka to play nice with the confuent-kafka-go package

this is my first question on StackOverflow. Usually I find a solution from someone else's question but this time the internet does not seem to have many answers.
So I'm getting this message after using go get and every time I try and compile and run my application.
# pkg-config --cflags rdkafka
Package rdkafka was not found in the pkg-config
search path. Perhaps you should add the directory containing `rdkafka.pc'
to the PKG_CONFIG_PATH environment variable Package 'rdkafka', required by
'virtual:world', not found
I searched the issues on the github page for the repo and found one thread related to this, but none of those solutions seem to work for me. I'm running fedora 26, I have go 1.9 installed.
I've tried:
dnf install
Compiling from source as instructed on their README
yum install because I became desperate.
Downloading and installing from the RPM
Has anyone come accross this and maybe have an idea of how I can fix it?
I suggest that you install librdkafka from Confluent's repository as described in their documentation. But I think that you'll need to build librdkafka from source RPMs, like I'm doing for Ubuntu.
So I got it working thanks to Remi. Adding the repo from https://rpms.remirepo.net/ (I used the one for Fedora 26). Then just installing it using:
sudo dnf --enablerepo=remi install librdkafka-devel

How to package go project for homebrew

We're developing runscripts and try to support something like brew install runscripts.
It's written in golang and have some dependencies which required to go get. Now I have no idea to write the Formula to setup GOPATH and run go get. Our project can be compiled into an binary but we need run --init to install it.
Can anyone helps to give an example about a homebrew Formula of go project?
Fork homebrew, look at the content of Library/Formula/consul.rb. You don't need to manually generate all the resources. Use homebrew-go-resources. A more complete intro could be found here.
I have refer to termshare.rb and it seems we can simply go get and homebrew will handle anything about GOPATH for us.
That's great and I think my problem is solved.
The best I could find is how docker-swarm is added to brew: https://github.com/Homebrew/homebrew/blob/4c6857b0e337b2d5afd49dcf7209b6b5091709f4/Library/Formula/docker-swarm.rb
It's relatively clean and simple to follow.
You can use goreleaser to generate the formula automatically: https://goreleaser.com/customization/homebrew/
Here is a possible work around creating a build directory within the checkout as the GOPATH:
...
def install
system "mkdir -p build/src"
system "ln -s `pwd` build/src/repo"
system "GOPATH=`pwd`/build go get repo/mytool"
bin.install "build/bin/mytool"
...
end
...

Resources