卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章79632本站已运行4416
分类:

TAG:错了

错了

从 cobra 子命令检索的上下文为空

从 cobra 子命令检索的上下文为空

问题内容我想要一个全局超时(在 rootCmd 中设置),因此我在 rootCmd 中设置如下
ctxInit := context.Background()
timeout := viper.GetInt(timeout)
ctx, cancel := cont...

admin2024-02-063 浏览0条评论0
Kotlin 和 Golang 中的字符串散列

Kotlin 和 Golang 中的字符串散列

问题内容在服务 a 中,我有一个像这样进行哈希处理的字符串:
fun string.tohash(): long {var hashcode = this.hashcode().tolong()if (hashcode 0l) {
...

admin2024-02-064 浏览0条评论0
使用 gorm 和 sqlmock 进行测试

使用 gorm 和 sqlmock 进行测试

问题内容我正在努力使用 sqlmock 和 gorm 为我的 go lambda 函数编写测试。
这是我要测试的功能:
func docleanup(con *gorm.db) {sixmonthsago := time.now().addda...

admin2024-02-055 浏览0条评论0