命令 "go get github.com/gohugoio/hugo" 失败并以 2 退出

The command "go get github.com/gohugoio/hugo" failed and exited with 2 during

我正在使用 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.yml

sudo: false

language: go

git:
  depth: 1

install: 
  - go get github.com/gohugoio/hugo

script:
  - git submodule init
  - git submodule update
  - hugo

  # Deploy to GitHub pages
deploy:
  provider: pages
  skip_cleanup: true
  github_token: $GITHUB_TOKEN
  local_dir: public
  on:
    branch: master

Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build.

  • docker 运行 -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 运行 -it golang:1.11

    root@07e6e634656a: 去获取 https://github.com/gohugoio/hugo

    不会return任何错误

using go versions > 1.11 will not cause this issue.
In example 1,similar error is there.
In example 2,it is installed successfully.