Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support cwgo generate code && service registry extension #99

Closed
wants to merge 14 commits into from

Conversation

chaoranz758
Copy link
Member

@chaoranz758 chaoranz758 commented Nov 27, 2023

What type of PR is this?

feat

What this PR does / why we need it (en: English/zh: Chinese):

en: feat: support cwgo generate code && service registry extension
zh:支持 cwgo 生成代码的能力 && 集成 cwgo 服务注册与发现的能力 && 用户可自定义服务注册与发现扩展

Which issue(s) this PR fixes:

#106

@li-jin-gou
Copy link
Member

cc @rogerogers

}
}

func resolverConfig() []*survey.Question {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it called a resolver? Most people are more familiar with the term "registry center".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the client side, service resolver maybe better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

既然引入了 gofumpt, 使用以下类似的方法使用 gofumpt 怎么样
image

ca.Registry != consts.Etcd &&
ca.Registry != consts.Polaris {
return errors.New("unsupported registry")
if ca.Resolver != "" &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不应该使用 || 吗?

假定就是 ||, 我觉得可以把这些 registry consts 写成一个切片, 循环进行比对

import "github.com/cloudwego/cwgo/pkg/consts"

// related to service resolver
var (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实这类文件是 registry 的 tpl 文件, 要不将这类文件的名字改为 hz_client_registry_tpl.go 之类的?

@chaoranz758 chaoranz758 reopened this Dec 26, 2023
@li-jin-gou li-jin-gou closed this Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants