it tells me that the command -go get- is no longer supported. I tried with command install and the @latest suffix but I can’t get it to work. I also tried to include the line in the go program:
it tells me that the command -go get- is no longer supported
Was the message “‘go get’ is no longer supported outside a module.” ? If it was then the last three words, “outside a module”, are your clue.
There are many articles out there where you can read about Go modules. But the gist of what you’ll need to do will be along these lines.
cd <my-project>
# initialize a module
go mod init <my-project-package-name>
# for example : go mod init github.com/myusername/myproject
# or even just : go mod init myproject
# get your dependency, it will be added to `go.mod`
go get github.com/eclipse/paho.mqtt.golang
You will then be able to import github.com/eclipse/paho.mqtt.golang .
now I’v try to do all your suggestions commands and I edit a simple program “mypaho.go” with the example found in:
and I’v test it. But I’v this error:
go test mypaho.go
mypaho.go:4:8: no required module provides package github.com/eclipse/paho.mqtt.golang: go.mod file not found in current directory or any parent directory; see ‘go help modules’