zeromicro / go-zero Goto Github PK
View Code? Open in Web Editor NEWA cloud-native Go microservices framework with cli tool for productivity.
Home Page: https://go-zero.dev
License: MIT License
A cloud-native Go microservices framework with cli tool for productivity.
Home Page: https://go-zero.dev
License: MIT License
我在参考贵司该项目时有几个问题困扰?
①:请问贵司出于什么考虑将之前的Mongo换成mysql了呢?(我司重度mongo用户😂)
②:Mongo不可以做微服务的存储仓吗?
③:该项目的分布式事务时啥方案啊?
劳烦解惑啊
这里 先get再watch,在两个执行过程中,如果刚好有新的服务在load之后、watch之前注册了,那这个服务可能不会被发现,可以尝试在 load 与 watch 中间加 sleep 进行测试复现
c.load(cli, key)
c.watchGroup.Run(func() {
c.watch(cli, key)
})
goctl 支持pgsql生成?
提供admin可选插件可以直接支持系统状态的简单查看监控,作为一个独立框架感觉会更完善
我还没读代码,先提一个问题。请问全局事物这部分如何设计的?
想改造成 https 协议的,可以配置实现吗
a.api
文件。过几天,我开发B功能,写了一个b.api
。我想通过goctl api go --api b.api
生成B功能相关的代码,但是就会遇到类似截图中的困境:无法在当前项目目录下生成B功能相关的代码,如果选择生成,之前开发的功能的部分代码就会被覆盖掉(types.go、routes.go等)。覆盖
和追加
两种代码生成模式。比如在二次执行goctl api go --api xxx.api
时,由操作人选择是覆盖或者追加到已有的代码文件中(types.go、routes.go等)。types/a.go
中,b.api生成的types相关的代码就放置在types/b.go
中。这样一来,b模块代码的生成不会直接覆盖掉以后的代码。其他模块也类似。如果能做到包级的相互隔离就更赞了。gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:32:19: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:43:21: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:47:19: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in slice literal:
cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:51:19: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in slice literal:
cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:63:21: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:74:21: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:85:21: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:89:21: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:100:21: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:104:21: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
gopath/src/github.com/tal-tech/go-zero/tools/goctl/goctl.go:104:21: too many errors
goctl创建的项目 run的时候报如下错误,这个是依赖版本有问题嘛?
# go.etcd.io/etcd/clientv3/balancer/picker
F:\xxx\pkg\mod\go.etcd.io\e[email protected]\clientv3\balancer\picker\err.go:25:9: cannot use &errPicker literal (type *errPicker) as type Picker in return argument:
*errPicker does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
F:\xxx\pkg\mod\go.etcd.io\e[email protected]\clientv3\balancer\picker\roundrobin_balanced.go:33:9: cannot use &rrBalanced literal (type *rrBalanced) as type Picker in return argument:
*rrBalanced does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
# github.com/tal-tech/go-zero/zrpc/internal/balancer/p2c
F:\xxx\pkg\mod\github.com\tal-tech\g[email protected]\zrpc\internal\balancer\p2c\p2c.go:41:32: not enough arguments in call to base.NewBalancerBuilder
have (string, *p2cPickerBuilder)
want (string, base.PickerBuilder, base.Config)
F:\xxx\pkg\mod\github.com\tal-tech\g[email protected]\zrpc\internal\balancer\p2c\p2c.go:58:9: cannot use &p2cPicker literal (type *p2cPicker) as type balancer.Picker in return argument:
*p2cPicker does not implement balancer.Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
timer.item.removed = true
newItem := &timingEntry{
baseEntry: task,
value: timer.item.value,
}
tw.slots[pos].PushBack(newItem)
tw.setTimerPosition(pos, newItem)
以上代码中,旧的task的removed被标记为了true,但是新、旧task在timers里都是同样的key,当执行到旧task时从timers里移除了该key,当再move或remove新task的时候由于key已经不存在,导致执行失效了。
一下代码可以测试出bug:
const testStep = time.Second
func TestMoveTask(t *testing.T) {
keys := make([]string, 0)
tw, _ := NewTimingWheel(testStep, 10, func(k, v interface{}) {
keys = append(keys, k.(string))
fmt.Printf("%v\n", k)
})
fmt.Printf("第一次SetTimer\n")
tw.SetTimer("first", "v1", testStep * 8)
time.Sleep(testStep * 6)
fmt.Printf("move task\n")
tw.MoveTimer("first", testStep * 7)
time.Sleep(testStep * 3)
fmt.Printf("remove task\n")
tw.removeTask("first")
time.Sleep(testStep * 30)
assert.Equal(t, 0, len(keys))
}
goctl rpc proto -src transform.proto -dir .
当编译pb文件时候,会出现两个报错
Missing 'go_package' option in "transform.proto"
--go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC
internal/svc/servicecontext.go 中 NewErr 返回 errPicker 参数与 Picker 不一致
errPicker 为3个, Picker 为 2个
func (ep *errPicker) Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error) {
return nil, nil, ep.err
}
type Picker interface {
Pick(info PickInfo) (PickResult, error)
}
package picker
import (
"context"
"google.golang.org/grpc/balancer"
)
// NewErr returns a picker that always returns err on "Pick".
func NewErr(err error) Picker {
return &errPicker{p: Error, err: err}
}
type errPicker struct {
p Policy
err error
}
func (ep *errPicker) String() string {
return ep.p.String()
}
func (ep *errPicker) Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error) {
return nil, nil, ep.err
}
mkdir hello && cd hello
goctl rpc template -o=hello.proto
goctl rpc proto -src hello.proto
go run hello.go
# go.etcd.io/etcd/clientv3/balancer/picker
../../../../go/pkg/mod/go.etcd.io/[email protected]/clientv3/balancer/picker/err.go:25:9: cannot use &errPicker literal (type *errPicker) as type Picker in return argument:
*errPicker does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
../../../../go/pkg/mod/go.etcd.io/[email protected]/clientv3/balancer/picker/roundrobin_balanced.go:33:9: cannot use &rrBalanced literal (type *rrBalanced) as type Picker in return argument:
*rrBalanced does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
# github.com/tal-tech/go-zero/zrpc/internal/balancer/p2c
../../../../go/pkg/mod/github.com/tal-tech/[email protected]/zrpc/internal/balancer/p2c/p2c.go:41:32: not enough arguments in call to base.NewBalancerBuilder
have (string, *p2cPickerBuilder)
want (string, base.PickerBuilder, base.Config)
../../../../go/pkg/mod/github.com/tal-tech/[email protected]/zrpc/internal/balancer/p2c/p2c.go:58:9: cannot use &p2cPicker literal (type *p2cPicker) as type balancer.Picker in return argument:
*p2cPicker does not implement balancer.Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
go-zero支持tcp长链吗?或者有比较好的思路?
麻雀虽小,五脏俱全的那种,一个简单的博客网站就行。
什么时候支持k8s?
语鹊的文档地址:https://www.yuque.com/tal-tech/go-zero/zig6zy
文中说的“带上 dts.insertExecutor.Wait(),当然要等待全部的 goroutine task 完成”,我做了个实验,代码如下:
executor := executors.NewBulkExecutor(
myExecutor,
executors.WithBulkInterval(time.Second*3), // 3s会自动刷一次container中task去执行
executors.WithBulkTasks(16), // container最大task数。一般设为2的幂次
)
for i := 0; i < 20; i++ {
executor.Add(i)
}
executor.Wait()
// time.Sleep(10 * time.Second)
// executor.Flush()
如果把executor.Flush()注释掉,只会打印出0到15,进程就退出了,剩下的任务就丢失了。因为periodicalexecutor.go里的 pe.waitGroup.Add(1) 是在子协程里调用的,所以调用了executor.Wait()主协程也等不到子协程到ticker的时间自动去flush就退出了,所以16到20的任务就丢失了。在主协程调用executor.Flush(),其实是把剩下的任务取出到了主协程来执行了,如果忘了的话就会丢任务。或者主协程执行的时间足够长,能让子协程达到ticker的时间自动去flush。
如题,希望能同时支持 http 和 rpc 这样的多种协议
建议:利用反射获取结构体注解的文档注释,自动生成swagger文档
可参考:https://github.com/henrylee2cn/apiware 项目实现。
Apiware将Go语言net/http及fasthttp请求的指定参数绑定到结构体,并验证参数值的合法性。 建议您可以使用结构体作为web框架的Handler,并用该中间件快速绑定请求参数,节省了大量参数类型转换与有效性验证的工作。同时还可以通过该结构体标签,创建swagger的json配置文件,轻松创建api文档服务。
➜ go-zero goctl api -o greet.api
2020/08/27 10:59:46 cpu_linux.go:27 open cpuacct.usage_percpu: no such file or directory
2020/08/27 10:59:46 {"@timestamp":"2020-08-27T10:59:46.111+08","level":"fatal","content":"cpu_linux.go:27 open cpuacct.usage_percpu: no such file or directory"}
这块cpu相关的stat是否可以通过配置屏蔽?
2020/09/18 10:44:02 gen.go:57 'pwd' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
chineese characters are hard to read
Running tool: /usr/local/go/bin/go test -timeout 30s github.com/tal-tech/go-zero/core/collection -run ^TestConcurrent$
fatal error: concurrent map read and map write
fatal error: concurrent map write
func TestConcurrent(t *testing.T) {
set := NewSet()
go func() {
i := 0
for {
set.AddInt(i)
i++
if i == 10000 {
return
}
}
}()
go func() {
i := 10000
for {
set.Remove(i)
if i < 1 {
return
}
i--
}
}()
go func() {
i := 10000
for {
set.Contains(i)
i--
if i < 1 {
return
}
}
}()
time.Sleep(time.Second * 5)
}
系统环境:
平台:MacOS Catalina 10.15.5
GO ENV:
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/xx/Library/Caches/go-build"
GOENV="/Users/xx/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/xx/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/xx/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn/,direct"
GOROOT="/usr/local/Cellar/go/1.15.1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/xx/docker-files/dnmp/www/shorturl/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/q1/k1fjfgbs1ynbrzj33jqqg7680000gp/T/go-build909429352=/tmp/go-build -gno-record-gcc-switches -fno-common"
Go 依赖做了调整:
replace (
github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
google.golang.org/grpc => google.golang.org/grpc v1.26.0
)
其他依赖保持默认的状态
运行教程 “快速构建高并发微服务”
执行 go run transform.go -f etc/transform.yaml
出现以下错误:
# google.golang.org/genproto/googleapis/rpc/status
/Users/xx/go/pkg/mod/google.golang.org/[email protected]/googleapis/rpc/status/status.pb.go:42:11: undefined: "github.com/golang/protobuf/proto".ProtoPackageIsVersion4
# google.golang.org/genproto/googleapis/api/annotations
/Users/xx/go/pkg/mod/google.golang.org/[email protected]/googleapis/api/annotations/annotations.pb.go:41:11: undefined: "github.com/golang/protobuf/proto".ProtoPackageIsVersion4
/Users/xx/go/pkg/mod/google.golang.org/[email protected]/googleapis/api/annotations/client.pb.go:41:11: undefined: "github.com/golang/protobuf/proto".ProtoPackageIsVersion4
/Users/xx/go/pkg/mod/google.golang.org/[email protected]/googleapis/api/annotations/field_behavior.pb.go:42:11: undefined: "github.com/golang/protobuf/proto".ProtoPackageIsVersion4
/Users/xx/go/pkg/mod/google.golang.org/[email protected]/googleapis/api/annotations/http.pb.go:41:11: undefined: "github.com/golang/protobuf/proto".ProtoPackageIsVersion4
/Users/xx/go/pkg/mod/google.golang.org/[email protected]/googleapis/api/annotations/resource.pb.go:42:11: undefined: "github.com/golang/protobuf/proto".ProtoPackageIsVersion4
疑问🤔️:网上查了以下,说是 github.com/golang/protobuf v1.3.2
依赖的版本太低了,但是就是因为之前是 1.4.1 导致有问题才做了降级,现在这个问题该怎么处理呢,不可能再做升级处理吧
why not use hystrix-go but implementing one yourself. Could you please talk about some comparisons between core/breaker
and hystrix-go
. I'm curious about the new design, thx.
rt
目前看了下core/store/redis里面redis连接的代码,redis pool参数都是默认的,满足不了所有公司的需求,比如redis的最大连接数、redis的最大空闲数以及超时时间等,这样会更灵活一些?
按照例子 ”快速构建高并发微服务“
https://github.com/tal-tech/go-zero/blob/master/doc/shorturl.md
运行
go run transform.go -f etc/transform.yaml
发生错误 (看起来是服务注册 etcd 时有点问题)
# go.etcd.io/etcd/clientv3/balancer/picker
../../../../go/pkg/mod/go.etcd.io/[email protected]/clientv3/balancer/picker/err.go:25:9: cannot use &errPicker literal (type *errPicker) as type Picker in return argument:
*errPicker does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
../../../../go/pkg/mod/go.etcd.io/[email protected]/clientv3/balancer/picker/roundrobin_balanced.go:33:9: cannot use &rrBalanced literal (type *rrBalanced) as type Picker in return argument:
*rrBalanced does not implement Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
# github.com/tal-tech/go-zero/zrpc/internal/balancer/p2c
../../../../go/pkg/mod/github.com/tal-tech/[email protected]/zrpc/internal/balancer/p2c/p2c.go:41:32: not enough arguments in call to base.NewBalancerBuilder
have (string, *p2cPickerBuilder)
want (string, base.PickerBuilder, base.Config)
../../../../go/pkg/mod/github.com/tal-tech/[email protected]/zrpc/internal/balancer/p2c/p2c.go:58:9: cannot use &p2cPicker literal (type *p2cPicker) as type balancer.Picker in return argument:
*p2cPicker does not implement balancer.Picker (wrong type for Pick method)
have Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error)
want Pick(balancer.PickInfo) (balancer.PickResult, error)
etcd version
etcd Version: 3.4.13
Git SHA: Not provided (use ./build instead of go build)
Go Version: go1.15
Go OS/Arch: darwin/amd64
type Request struct {
Name string `json:"name" form:"name" path:"name"`
}
when pass params on url
curl -i http://localhost:8888/users/id/1?name=1
and then get error: "field name is not set"
根据这个文档来的 https://www.yuque.com/tal-tech/go-zero/nkg20f
执行的时候报错
$ goctl model mysql datasource -url="root:root@tcp(127.0.0.1:3306)/blog" -table="posts" -dir ./model
82:71: expected selector or type assertion, found ')' (and 5 more errors)
根据db生成model代码
数据库是这样的
CREATE TABLE `posts` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`content` text,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
就像:
types.TypeString(xxx, qualifier)
What issue is?
/kind/feat
What happended?
When I use goctl to generate model but goctl tells me that unexpected database type: json.Maybe there are other some types which goctl is not supported.
https://www.yuque.com/tal-tech/go-zero/ze9i30
import "foo1.api"
import "foo2.api"
应该是没有引号的.
另外goland插件上 对import支持的也是带引号的. 没引号就会提示错误,
命令行运行没问题.
应该是带引号的 goctl里可能没把引号去掉
#190
目前有些级别的日志有文件名和行数内容输出,比如error级别日志,有些级别的日志无文件名和行数内容输出,例如
{"@timestamp":"2020-10-25T18:39:21.376+08","level":"slow","content":"hello slow world"}
{"@timestamp":"2020-10-25T18:39:21.376+08","level":"stat","content":"hello stat world"}
{"@timestamp":"2020-10-25T18:39:21.376+08","level":"info","duration":"61000.0ms","content":"hello"}
{"@timestamp":"2020-10-25T18:39:21.376+08","level":"error","duration":"61000.0ms","content":"logging.go:28 hello"}
{"@timestamp":"2020-10-25T18:39:21.376+08","level":"error","duration":"1000.0ms","content":"logging.go:10 world"}
建议所有日志统一添加文件名以及行数
请教一下大佬,bookstore中,我需要生成哪些dockerfile,怎么生成?然后怎么用?
如果需要在k8s中部署,有没有可以参考的配置文件?
谢谢
请求参数验证, json, form 两种标签无法同时存在
from && json 标签无法同时处理,
type UpdateReq struct {
Id int64 `path:"id"`
Mobile string `form:"mobile" json:"mobile"`
}
field mobile is not set
使用 goctl api new greet 出现这个错误,不知道怎么处理
执行命令cmd,及log
`
G:\go\src\kispr\greet 的目录
2020/10/25 16:13
.G:\go\src\kispr\greet>dir
驱动器 G 中的卷是 新加卷
卷的序列号是 AA02-EC66
G:\go\src\kispr\greet 的目录
2020/10/25 16:13
.G:\go\src\kispr\greet>G:\go\bin\goctl api new greet
�[32mDone.�[0m
G:\go\src\kispr\greet>G:\go\bin\goctl api go -api greet.api -dir .
error: near line: 15, wrong line "get /greet/from/:name(Request) returns ( );",
"route syntax: [get/post/delete] /path(request) returns[(response)]"
G:\go\src\kispr\greet>G:\go\bin\goctl -api greet.api -dir .
Incorrect Usage. flag provided but not defined: -api
NAME:
goctl - a cli tool to generate code
USAGE:
goctl [global options] command [command options] [arguments...]
VERSION:
20201021 windows/amd64
COMMANDS:
api generate api related files
docker generate Dockerfile and Makefile
rpc generate rpc code
model generate model code
config generate config json
template template operation
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
error: flag provided but not defined: -api
G:\go\src\kispr\greet>G:\go\bin\goctl api go -api greet.api
error: missing -dir
G:\go\src\kispr\greet>G:\go\bin\goctl api go -api greet.api -dir .
error: near line: 15, wrong line "get /greet/from/:name(Request) returns ( );",
"route syntax: [get/post/delete] /path(request) returns[(response)]"
G:\go\src\kispr\greet>G:\go\bin\goctl -api greet.api -dir .
Incorrect Usage. flag provided but not defined: -api
NAME:
goctl - a cli tool to generate code
USAGE:
goctl [global options] command [command options] [arguments...]
VERSION:
20201021 windows/amd64
COMMANDS:
api generate api related files
docker generate Dockerfile and Makefile
rpc generate rpc code
model generate model code
config generate config json
template template operation
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
error: flag provided but not defined: -api
G:\go\src\kispr\greet>G:\go\bin\goctl api go -dir .
error: missing -api
G:\go\src\kispr\greet>G:\go\bin\goctl api new greet
G:\go\src\kispr\greet\greet/etc/greet-api.yaml exists, ignored generation
G:\go\src\kispr\greet\greet/internal/config/config.go exists, ignored generation
G:\go\src\kispr\greet\greet/greet.go exists, ignored generation
G:\go\src\kispr\greet\greet/internal/svc/servicecontext.go exists, ignored gener
ation
G:\go\src\kispr\greet\greet/internal/types/types.go exists, ignored generation
G:\go\src\kispr\greet\greet/internal/handler/greethandler.go exists, ignored gen
eration
G:\go\src\kispr\greet\greet/internal/handler/routes.go exists, ignored generatio
n
G:\go\src\kispr\greet\greet/internal/logic/greetlogic.go exists, ignored generat
ion
�[32mDone.�[0m
G:\go\src\kispr\greet>`
imports (
"go-zero/greet/internal/svc" // 生成的
"study/go-zero/greet/internal/svc" // 期望的
)
调试发现auth.Authenticate 这个方法没有走,是哪里设置错了吗?
Auth: true
StrictControl: false
Redis:
Key: appserver.auth
Host: 127.0.0.1:6379
Type: node
Starting rpc server at 127.0.0.1:8080...
{"level":"warn","ts":"2020-10-14T15:29:28.833+0800","caller":"clientv3/retry_interceptor.go:62","msg":"retrying of unary invoker failed","target":"passthrough:///localhost:2379","attempt":0,"error":"rpc error: code = DeadlineExceeded desc = latest balancer error: connection closed"}
{"@timestamp":"2020-10-14T15:29:28.834+08","level":"error","content":"server.go:83 context deadline exceeded"}
panic: context deadline exceeded
goroutine 1 [running]:
github.com/tal-tech/go-zero/zrpc.(*RpcServer).Start(0xc0001249a0)
/root/go/pkg/mod/github.com/tal-tech/[email protected]/zrpc/server.go:84 +0xce
main.main()
/root/golang/bookstore/rpc/check/check.go:37 +0x33f
exit status 2
出不出相应的视频教程啊?
rpc error: code = Unknown desc = sql: Scan error on column index 12, name "DELISTINGDATE": unsupported Scan, storing driver.Value type into type *time.Time
字段定义: DELISTINGDATE
datetime DEFAULT NULL,当值为null时解析报错了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.