[Go] 有了 cast 组件, golang 类型转换从此不再困扰

通过llama.cpp与羊驼聊天的网页界面- 详解 Serge 的启动使用

 

在 golang 中,参数和返回值之间往往涉及 int、string、[]、map 等之间的转换。

 

如果是手动去处理,一容易出错,二不能兼容多数类型,比较麻烦。

 

使用 cast,能够让代码更健壮、可维护性也更高。

 

Refer: Golang的类型转换

Refer:https://github.com/spf13/cast

Link:https://www.cnblogs.com/farwish/p/13063524.html

posted on 2020-06-08 07:28  ercom  阅读(1030)  评论(0编辑  收藏  举报