代码:
package mainimport (...(略)"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 job1imports github.com/src-d/go-gitvendor/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
解决:
import (...(略)"gopkg.in/src-d/go-git.v4"...(略)
)
替换引用。
ref:
https://github.com/src-d/go-git/issues/914