登录
首页 >  Golang >  Go问答

无法将 r.Condition.AgeInDays(int64 类型的变量)用作 *int64 类型的结构体字段

来源:stackoverflow

时间:2024-02-05 23:27:17 104浏览 收藏

小伙伴们对Golang编程感兴趣吗?是否正在学习相关知识点?如果是,那么本文《无法将 r.Condition.AgeInDays(int64 类型的变量)用作 *int64 类型的结构体字段》,就很适合你,本篇文章讲解的知识点主要包括。在之后的文章中也会多多分享相关知识点,希望对大家的知识积累有所帮助!

问题内容

当我将 firebase 导入 golang 文件时,我看到这个错误。 我是新手,正在学习 golang,请帮我解决这些问题 我的代码:

package main

import (
    "fmt"
    "log"
    "firebase.google.com/go"
    "google.golang.org/api/option"
)

func helloworld(c *fiber.ctx)  {
    c.send("hello world")
}

func main()  {
    //connect db
    sa := option.withcredentialsfile("./webgolang.json")
    app, err := firebase.newapp(context.background(), nil, sa)
    client, err := app.firestore(context.background())
    if err != nil {
        log.fatalln(err)
    }
    defer client.close()

    //
    app := fiber.new()
    app.get("/", helloworld)
    setuproutes(app)

    app.listen(4000)
}

这是错误

C:\Users\HP\go\pkg\mod\cloud.google.com\go\[email protected]\bucket.go:1504:30: cannot use r.Condition.AgeInDays (variable of type int64) as type *int64 in struct literal
C:\Users\HP\go\pkg\mod\cloud.google.com\go\[email protected]\bucket.go:1592:30: cannot use rr.Condition.Age (variable of type *int64) as type int64 in struct literal

正确答案


将云存储版本升级到v1.26.0,因此如果您转到go.mod文件,您应该有以下内容:

cloud.google.com/go/storage v1.26.0 // indirect

理论要掌握,实操不能落!以上关于《无法将 r.Condition.AgeInDays(int64 类型的变量)用作 *int64 类型的结构体字段》的详细介绍,大家都掌握了吧!如果想要继续提升自己的能力,那么就来关注golang学习网公众号吧!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>