Coder Social home page Coder Social logo

cloudwego.github.io's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudwego.github.io's Issues

Server SDK化

can not find "github.com/cloudwego/kitex/sdk/message",maybe "github.com/cloudwego/kitex/pkg/remote/trans/invoke" i guess?

快速开始/安装代码生成工具中的问题

针对第2步和第3步。

  1. 安装 kitex:go get github.com/cloudwego/kitex/tool/cmd/kitex@latest
  2. 安装 thriftgo:go get github.com/cloudwego/thriftgo@latest

会收到如下提示。

go get: installing executables with 'go get' in module mode is deprecated.
        Use 'go install pkg@version' instead.
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.

是否更换到用go install会更好?

快速开始文档有误

运行示例代码下的输出和上面示例代码对不上

输出部分文档如下:

如果不出意外,我们可以看到类似如下输出
$ {"message":"pong"}
到现在,我们已经成功启动了 Hertz Server,并完成了一次调用。

而上方示例代码如下:

func main() {
    h := server.Default()

    h.GET("/ping", func(c context.Context, ctx *app.RequestContext) {
            ctx.JSON(consts.StatusOK, utils.H{"ping": "pong"})
    })

    h.Spin()
}

internal framework name displayed in Kitex doc

I noticed there's a quote for ginex in the Kitex generic-call doc. Maybe we should change it to gin or hertz now ?

https://www.cloudwego.io/zh/docs/kitex/tutorials/advanced-feature/generic-call/

cli, err := genericclient.NewClient("destServiceName", g, opts...)
    if err != nil {
        panic(err)
    }
    // 构造request,或者从ginex获取
    body := map[string]interface{}{
        "text": "text",
        "some": map[string]interface{}{
            "id":   1,
            "text": "text",
        },
        "req_items_map": map[string]interface{}{
            "1": map[string]interface{}{
                "id":   1,
                "text": "text",
            },
        },
    }

JWT认证

修改jwt的实现,添加一个从postform中获取token的配置是不是会更完美?

路由

你好,对于通配路由中*path 的匹配情况:

路径 是否匹配
/src/ 匹配
/src/somefile.go 匹配
/src/subdir/somefile.go 不匹配

经过实际尝试,似乎第三种情况是会被匹配的,也就是通配路由可以跨越单个路径段。

不知道是不是我理解上有什么问题?

如果需要,我可以提供复现的代码和请求,不过只需要仿照上下文就可以了,subdir 多层也会被匹配

编解码协议

kitex -type thrift ${service_name} ${idl_name}.thrift
这里这种格式,提示如下。实际我是存在该文件的

Require exactly 1 IDL file.

代码示例

[root@localhost super_faceimglocaloss]# ./faceimglocaloss
panic: Unsupported CPU, maybe it's too old to run Sonic.

goroutine 1 [running]:
github.com/bytedance/sonic/internal/native.init.0()
F:/golang/GOPATH/pkg/mod/github.com/bytedance/[email protected]/internal/native/dispatch_amd64.go:144 +0x1fb

我这是虚拟机,cpu太旧了,,不能用,这是要我放弃了

kitex_gen内的代码生成不完全

这是我在调用sh bulid.sh生成项目的时候遇到的一部分报错信息

../../gopath/pkg/mod/github.com/cloudwego/[email protected]/pkg/generic/thrift/base.go:63:14: not enough arguments in call to iprot.ReadStructBegin
have ()
want (context.Context)
../../gopath/pkg/mod/github.com/cloudwego/[email protected]/pkg/generic/thrift/base.go:68:34: not enough arguments in call to iprot.ReadFieldBegin
have ()
want (context.Context)
../../gopath/pkg/mod/github.com/cloudwego/[email protected]/pkg/generic/thrift/base.go:83:25: not enough arguments in call to iprot.Skip
have ("github.com/apache/thrift/lib/go/thrift".TType)
want (context.Context, "github.com/apache/thrift/lib/go/thrift".TType)
../../gopath/pkg/mod/github.com/cloudwego/[email protected]/pkg/generic/thrift/base.go:93:25: not enough arguments in call to iprot.Skip
have ("github.com/apache/thrift/lib/go/thrift".TType)
want (context.Context, "github.com/apache/thrift/lib/go/thrift".TType)
../../gopath/pkg/mod/github.com/cloudwego/[email protected]/pkg/generic/thrift/base.go:98:24: not enough arguments in call to iprot.Skip
have ("github.com/apache/thrift/lib/go/thrift".TType)
want (context.Context, "github.com/apache/thrift/lib/go/thrift".TType)
../../gopath/pkg/mod/github.com/cloudwego/[email protected]/pkg/generic/thrift/base.go:103:12: not enough arguments in call to iprot.ReadFieldEnd
have ()
want (context.Context)

这是我的example.thrift设置

namespace go api 
struct Request {
  1: string message
}
struct Response {
  1: string message
}
service Echo {
    Response echo(1: Request req)
}

这是我的handler.go的代码

package main

import (
        "context"
        api "example/kitex_gen/api"
)

// EchoImpl implements the last service interface defined in the IDL.
type EchoImpl struct{}

// Echo implements the EchoImpl interface.
func (s *EchoImpl) Echo(ctx context.Context, req *api.Request) (resp *api.Response, err error) {
        // TODO: Your code here...
        return &api.Response{Message: req.Message}, nil
}

这是当前的go.mod设置

module example

go 1.16

require (
        github.com/apache/thrift v0.17.0
        github.com/cloudwego/kitex v0.4.4
)

我运行的平台是wsl2,Linux版本是Ubuntu-20.04

hz 使用 (thrift)跟着文档操作生成的代码函数调用参数不足

截屏2023-03-03 08 43 19

即使我不加module option一样会生成图片一样的代码

hz 版本
hz version v0.6.1

系统:macOS

go env:
nihilism@NihilismdeMacBook-Pro awesomeProject % go env
GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/nihilism/Library/Caches/go-build"
GOENV="/Users/nihilism/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/nihilism/sdk/go1.20.1/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/nihilism/sdk/go1.20.1:/Users/nihilism/sdk/go1.20.1/bin"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/Users/nihilism/sdk/go1.20.1"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/nihilism/sdk/go1.20.1/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20.1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/nihilism/GolandProjects/awesomeProject/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hp/k_nbwpfd0813gzgswbrz0h5m0000gn/

JSON Marshal 库

windows10 go 1.18.6, occured UnsupporetedCPU ,maybe it‘s too old to run Sonic in Cloudwego/Hertz

配置说明

image
WithDialTimeout是否已经被废弃了,在源码中未找到,但文档中有

报错

........\pkg\mod\github.com\cloudwego\[email protected]\pkg\network\standard\connection.go:50:25: undefined: unix.EPIPE
........\pkg\mod\github.com\cloudwego\[email protected]\pkg\network\standard\connection.go:50:55: undefined: unix.ENOTCONN

JSON Marshal 库

Mac M1 上编译报错这一块里面的
设置GOARCH参数为amd64(即GOARCH=amd64)。请去除该参数或设置为 `arm64``这句话应该是有歧义吧,我是设置为arm64才成功,那前面那句话设置为amd64是不是有问题

Thrift Validator:文档中未提示需要额外安装 github.com/cloudwego/thrift-gen-validator

[background] 在尝试cwg kitex 命令行工具选项 --thrift-plugin validator 自定义检验器时,发现直接使用会报找不到 "thrift-gen-validator" 的错误 ,如下提示:

$ kitex --thrift-plugin validator -service ${MODULE} ${IDL_PATH}
exec: "thrift-gen-validator": executable file not found in $PATH

翻了一下文档,貌似没提示需要额外安装 go get github.com/cloudwego/thrift-gen-validator
然后 go install 一下,thrift-gen-validator 就安装到了 $GOPATH/bin/ 下,可以被 kitex 命令行工具直接调用了。

所以提个小建议:可以在 validator doc 中添加一下提示。

kitex是否提供周期性更新的连接池

在Kubernetes场景下应用kitex,由于Kubernetes不能处理长连接的负载均衡,所以需要一种能够定时刷新连接(根据时间或者已处理请求数)的连接池。
请问类似的连接池在kitex中有无提供,如果没有,我可能考虑会实现一下。

hz 命令行工具使用

在使用 hz 工具的时候需要指定 thrift 的依赖版本为 v0.13.0,使用官网写的最新版本会出现编译错误。
image

注意事项

// 此时,hz 会把 model 生成在 "biz/mdoel"下

应该是:

// 此时,hz 会把 model 生成在 "biz/model"下

feature: add document search

Is your feature request related to a problem? Please describe.

I'm a new user of kitex, I often forget how to use, I only remember some keywords, but finding documents by keywords is very difficult

Describe the solution you'd like

Add search for the doc.

Hertz路由组示例

h := server.Default(server.WithHostPorts("127.0.0.1:8080"))
v1 := h.Group("/v1")
h.GET("/get", func(ctx context.Context, c *app.RequestContext) {
    c.String(consts.StatusOK, "get")
})
h.POST("/post", func(ctx context.Context, c *app.RequestContext) {
    c.String(consts.StatusOK, "post")
})

这个地方的h.GET和h.POST应该是v1.GET和v1.POST吧

RPC 框架 Kitex 实践入门:性能测试指南

每类连接模型没有绝对好坏,取决于实际使用场景。连接多路复用虽然一般来说性能相对最好,但应用上必须依赖协议能够支持包序列号,且一些老框架服务可能也并不支持多路复用的方式调用。

这句话里有一处不明白,是“能够支持包序列号”,还是想表达“序列化”?

熔断器使用说明有误?

https://www.cloudwego.io/zh/docs/kitex/tutorials/basic-feature/circuitbreaker/#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B

官网说默认提供的是 circuitbreaker.RPCInfo2Key,但是实际上是circuitbreak.RPCInfo2Key。并没有er

// build a new CBSuite
	cbs := circuitbreak.NewCBSuite(circuitbreak.RPCInfo2Key)
	c, err := userservice.NewClient(
		consts.UserServiceName,
		client.WithCircuitBreaker(cbs),
		client.WithResolver(r),
		client.WithMiddleware(mw.CommonMiddleware),
		client.WithInstanceMW(mw.ClientMiddleware),
		client.WithClientBasicInfo(&rpcinfo.EndpointBasicInfo{ServiceName: consts.ApiServiceName}),
	)

Optimise(docs): Improving Hertz's stream documentation

Is your feature request related to a problem? Please describe.

This issue is part of Hertz Recipes, a purposal to improve documentation quality for Hertz's functionalities

I opened this issue to investigate and keep track of answers of the following problem:

  1. What are docs of other go http frameworks?
  2. Which topic is covered in their docs and to which extent the topics have been discussed?
  3. What's missing in Hertz's doc?
  4. How should the doc be organised (the layout)?

Upon agreement of the community with regards to the question above, we should be finalised the documentation in both Chinese and English.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.