Closed printfcoder closed 4 years ago
go get -u github.com/micro/micro 报错
C:\Users\admin>go get -u github.com/micro/micro
# github.com/micro/go-micro/transport/quic
go\src\github.com\micro\go-micro\transport\quic\quic.go:121:3: unknown field 'IdleTimeout' in struct literal of type quic.Config
# github.com/coreos/etcd/clientv3
go\src\github.com\coreos\etcd\clientv3\auth.go:121:72: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.AuthEnable
go\src\github.com\coreos\etcd\clientv3\auth.go:126:74: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.AuthDisable
go\src\github.com\coreos\etcd\clientv3\auth.go:131:152: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserAdd
go\src\github.com\coreos\etcd\clientv3\auth.go:136:144: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserAdd
go\src\github.com\coreos\etcd\clientv3\auth.go:141:86: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserDelete
go\src\github.com\coreos\etcd\clientv3\auth.go:146:122: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserChangePassword
go\src\github.com\coreos\etcd\clientv3\auth.go:151:104: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserGrantRole
go\src\github.com\coreos\etcd\clientv3\auth.go:156:80: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserGet
go\src\github.com\coreos\etcd\clientv3\auth.go:161:72: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserList
go\src\github.com\coreos\etcd\clientv3\auth.go:166:106: cannot use auth.callOpts (type []"github.com/coreos/etcd/vendor/google.golang.org/grpc".CallOption) as type []"go.etcd.io/etcd/vendor/google.golang.org/grpc".CallOption in argument to auth.remote.UserRevokeRole
go\src\github.com\coreos\etcd\clientv3\auth.go:166:106: too many errors
@heyuanchao 你好,使用gomod,不要用gopath
运行 https://github.com/micro-in-cn/tutorials/tree/master/examples/basic-practices/micro-api/rpc 中的例子报错
# curl -H 'Content-Type: application/json' -d '{"name": "小小先"}' "http://localhost:8080/example/call"
POST http://localhost:8080/example/call
Content-Type: application/json
{"name": "小小先"}
{"id":"go.micro.api","code":500,"detail":"error during request: unknown field \"name\" in go_api.Request","status":"Internal Server Error"}
我改了下代码:
if req.Method != "POST" {
return errors.BadRequest("go.micro.api.example", "method: [%v], require post", req.Method)
}
# curl -H 'Content-Type: application/json' -d '{}' http://localhost:8080/example/foo/bar
POST http://localhost:8080/example/foo/bar
Content-Type: application/json
{"id":"go.micro.api.example","code":400,"detail":"method: [], require post","status":"Bad Request"}
@heyuanchao 请不要在无关issue下问无关的问题,需要新建issue
本期分享结束,关闭问题
本期内容
第一期:https://github.com/micro-in-cn/tutorials/issues/100 第一期资料:Bilibili, GoogleDocs Go 夜读:https://github.com/developer-learning/night-reading-go/issues/504