请问go-micro v2启动时报错,怎么解决

1.go-micro版本2.9
2.micro版本2.9.3
3.golang1.51环境配置

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\aaa\AppData\Local\go-build
set GOENV=C:\Users\aaa\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\goResources\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\goResources
set GOPRIVATE=
set GOPROXY=https://goproxy.cn
set GOROOT=D:\Go\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Go\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config

运行代码出现下面的错误

4.文件目录结构:
image
5.下面我测试的helloworld代码,运行报错:
(1)sever.go

package main

import (
	"context"
	"fmt"
	"github.com/micro/go-micro"
	helloworld "gocode/basic-code/go-high/微服务/go-micro/go-Micro-helloworld/proto"
)

type HW struct {

}

func (g*HW)Hello(ctx context.Context,req*helloworld.HelloRequest,rsp *helloworld.HelloResponse)error{
	rsp.Greeting="nihao:"+req.Name
	return nil
}

func main(){
	service:=micro.NewService(micro.Name("HelloWorld"),
		micro.Version("1.0"),
		micro.Metadata(map[string]string{"type":"helloworld"}))
	service.Init()
	helloworld.RegisterHelloWorldHandler(service.Server(),new(HW))
	if err:=service.Run();err!=nil{
		fmt.Println(err)//运行服务
	}
}

(2)Client.go

package main

import (
	"context"
	"fmt"
	"github.com/micro/go-micro"
	helloworld "gocode/basic-code/go-high/微服务/go-micro/go-Micro-helloworld/proto"
)

func main(){
	service:=micro.NewService(micro.Name("HelloWorld"),
		micro.Version("1.0"),
		micro.Metadata(map[string]string{"type":"helloworld"}))
	service.Init()
	greeter:=helloworld.NewHelloWorldService("HelloWorld",service.Client())
	rep,err:=greeter.Hello(context.TODO(),&helloworld.HelloRequest{Name:"haha "})
	if err!=nil{
		fmt.Println(err)
	}
	fmt.Println(rep.Greeting)
}

(3)proto下的helloworld.proto

syntax="proto3";

service HelloWorld{
    rpc Hello(HelloRequest) returns(HelloResponse){}
}
message HelloRequest{
    string name=1;
}
message HelloResponse{
    string greeting=2;
}

然后根据上面的自动生成相关代码
6.运行报错

你好,我试了下里面的方法还是不行,还是出现下面的问题:

D:\goResources\pkg\mod\github.com\coreos\etcd@v3.3.17+incompatible\clientv3\balancer\resolver\endpoint\endpoint.go:114:78: undefined: resolver.BuildOption
D:\goResources\pkg\mod\github.com\coreos\etcd@v3.3.17+incompatible\clientv3\balancer\resolver\endpoint\endpoint.go:182:31: undefined: resolver.ResolveNowOption

github.com/coreos/etcd/clientv3/balancer/picker

终于解决了,我跑别人的go-micro,跑通了,
我之前的go mod依赖可能存在问题,现在先按照别人的代码来写吧

replace了没,go版本也不要1.15,最高1.14

恩恩,解决了,是go-mod的问题。

修改 go.mod 最后添加一行
replace google.golang.org/grpc => google.golang.org/grpc v1.26.0