美文网首页
go: writing stat cache: open per

go: writing stat cache: open per

作者: 梨花菜 | 来源:发表于2021-03-08 11:49 被阅读0次

    背景

    原来是root用户执行的,后面改成lihuacai这个用户
    执行go build时,提示

    # lihuacai @ qa-cdh-001 in ~/code/go/src/GoBigDataTestTool on git:master x [11:14:23] C:2
    $ go build
    go: finding module for package github.com/go-sql-driver/mysql
    go: finding module for package github.com/astaxie/beego/orm
    go: finding module for package github.com/astaxie/beego
    go: finding module for package github.com/tidwall/sjson
    go: finding module for package github.com/tidwall/gjson
    go: finding module for package gopkg.in/confluentinc/confluent-kafka-go.v1/kafka
    go: writing stat cache: open /root/code/go/pkg/mod/cache/download/github.com/astaxie/beego/@v/v1.12.3.info1103410.tmp: permission denied
    go: downloading github.com/astaxie/beego v1.12.3
    go: writing stat cache: open /root/code/go/pkg/mod/cache/download/github.com/tidwall/gjson/@v/v1.6.8.info580695285.tmp: permission denied
    go: downloading github.com/tidwall/gjson v1.6.8
    go: writing stat cache: open /root/code/go/pkg/mod/cache/download/github.com/tidwall/sjson/@v/v1.1.5.info858958590.tmp: permission denied
    go: downloading github.com/tidwall/sjson v1.1.5
    go: writing stat cache: open /root/code/go/pkg/mod/cache/download/github.com/go-sql-driver/mysql/@v/v1.5.0.info69163632.tmp: permission denied
    go: downloading github.com/go-sql-driver/mysql v1.5.0
    controllers/kafka_template.go:12:2: open /root/code/go/pkg/mod/cache/download/github.com/astaxie/beego/@v/v1.12.3.lock: permission denied
    

    解决

    使用root用户执行[root@qa-cdh-001 ~]# chmod -R 775 /root/code/go/,修改文件权限
    其中/root/code/goGOPATH
    lihuacai属于root用户组,否则需要把775改成777
    重新执行go build即可

    相关文章

      网友评论

          本文标题:go: writing stat cache: open per

          本文链接:https://www.haomeiwen.com/subject/stjpqltx.html