下面由Golang教程栏目给大家介绍搭建go-micro开发环境的方法,希望对需要的朋友有所帮助!

最近因为要用到 go-micro,所以在学习微服务相关的内容,这一篇是记录 micro 的搭建过程。

安装环境

micro 提供了一个 runtime,在使用 go-micro 之前需要先安装它。有以下几种方式安装

源码

go get github.com/micro/micro/v2

这种方式我装不上,不是网络的原因,不知道哪里有冲突。。。

docker

docker pull micro/micro

二进制

# MacOS
curl -fsSL https://raw.githubusercontent.com/micro/micro/master/scripts/install.sh | /bin/bash

# Linux
wget -q  https://raw.githubusercontent.com/micro/micro/master/scripts/install.sh -O - | /bin/bash

# Windows
powershell -Command "iwr -useb https://raw.githubusercontent.com/micro/micro/master/scripts/install.ps1 | iex"


如何搭建go-micro开发环境