/mqtt-projects

Pub/Sub IoT data

Primary LanguageGo

mqtt-projects

This project uses paho.mqtt.golang as MQTT client library, install:

go get github.com/eclipse/paho.mqtt.golang

If you're encountering a red import error in Go when trying to import a package from GitHub.

Solution 1: If your project did not get any library yet, you need to create a go.mod first.

go mod init mymodule
go mod tidy

Solution 2: You may set GO111MODULE env var to auto

go env -w GO111MODULE=auto

Solution 3: Clear your Go module cache: If you're using Go modules, try clearing your module cache by running the following command:

go clean -modcache

This will remove all cached modules and force Go to re-download them.

Solution 4: Check your workspace settings: If you are using Visual Studio Code, make sure that your workspace settings are configured to use the correct GOPATH. GOPATH check by

go env

Configuring GOPATH by opening your workspace settings (Ctrl+Shift+P, then search for "Preferences: Open Workspace Settings"), and then setting the "go.gopath" property to the correct directory.