为了账号安全,请及时绑定邮箱和手机立即绑定

命令“go get github.com/gohugoio/hugo”失败并在期间以 2 退出

命令“go get github.com/gohugoio/hugo”失败并在期间以 2 退出

Go
千巷猫影 2022-04-26 10:54:12
我正在Hugo使用Travis-Ci. 最近(大约 3 天内)发生错误:$ go get github.com/gohugoio/hugo# github.com/gohugoio/hugo/tpl/internal/go_templates/fmtsort../../gohugoio/hugo/tpl/internal/go_templates/fmtsort/sort.go:58:18: mapValue.MapRange undefined (type reflect.Value has no field or method MapRange)The command "go get github.com/gohugoio/hugo" failed and exited with 2 during .由于代码go get在行出错,我认为它一定是由Hugo..travis.ymlsudo: falselanguage: gogit:  depth: 1install:   - go get github.com/gohugoio/hugoscript:  - git submodule init  - git submodule update  - hugo  # Deploy to GitHub pagesdeploy:  provider: pages  skip_cleanup: true  github_token: $GITHUB_TOKEN  local_dir: public  on:    branch: master
查看完整描述

1 回答

?
慕田峪7331174

TA贡献1828条经验 获得超13个赞

从 Hugo 0.48 开始,Hugo 使用 Go 1.11 内置的 Go Modules 支持来构建。

  • docker run -it golang:1.10

    root@2598ed7e489d: 去获取 github.com/gohugoio/hugo

    src/github.com/gohugoio/hugo/tpl/internal/go_templates/fmtsort/sort.go:58:18: mapValue.MapRange 未定义(类型 reflect.Value 没有字段或方法 MapRange)

  • docker run -it golang:1.11

    root@07e6e634656a: go get https://github.com/gohugoio/hugo

    不会返回任何错误

使用 go 版本 > 1.11 不会导致此问题。
在示例 1 中,存在类似的错误。
在示例 2 中,它已成功安装。


查看完整回答
反对 回复 2022-04-26
  • 1 回答
  • 0 关注
  • 195 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号