golang导入go-git错误记录

代码:

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  

解决:

import (
 ...()
	"gopkg.in/src-d/go-git.v4"
 ...()
)

替换引用。
ref:
https://github.com/src-d/go-git/issues/914

你可能感兴趣的:(golang,git,开发语言)