Before you use SDK for Go to send and subscribe to messages, perform the steps in this topic to prepare the environment.
Environment requirements
Go is installed. For more information, visit Installing Go from source.
After you install Go, you can run the go version
command to check the installed version.
Install SDK for Go
- Run the following command to enable Go mod:
go env -w GO111MODULE=on
- Run the following command to configure a Go mod proxy:
go env -w GOPROXY=https://goproxy.cn,direct
- Run the following command to initialize Go mod and generate the go.mod file:
go mod init
- Run the following command to install SDK for Go:
go get github.com/aliyunmq/mq-http-go-sdk