代码:
package main
import (
...(略)
"github.com/src-d/go-git"
...(略)
)
...(略)
func gitClone(workspace, url, referenceName string, auth ssh.AuthMethod) (*git.Repository, error) {
return git.PlainClone(workspace, false,
&git.CloneOptions{
URL: url,
ReferenceName: plumbing.ReferenceName(referenceName),
Auth: auth,
Progress: console.Stdout(), // 公司自己封装的log库
})
}
...(略)
导入:
# go mod tidy
# go mod vendor
编译,报错:
$ go build
package job1
imports github.com/src-d/go-git
vendor/github.com/src-d/go-git/repository.go:14:2: use of internal package gopkg.in/src-d/go-git.v4/internal/revision not allowed
解决:文章来源:https://www.toymoban.com/news/detail-815350.html
import (
...(略)
"gopkg.in/src-d/go-git.v4"
...(略)
)
替换引用。
ref:
https://github.com/src-d/go-git/issues/914文章来源地址https://www.toymoban.com/news/detail-815350.html
到了这里,关于golang导入go-git错误记录的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!