我分叉了一个 go模块,并想在我的项目中使用通过v1.12
. 我的代码不在我的GOPATH
.
我的项目go.mod
:
module github.com/me/myproj
go 1.12
require (
go.larrymyers.com/protoc-gen-twirp_typescript v0.0.0-20190605194555-ffbfe407b60f
)
replace go.larrymyers.com/protoc-gen-twirp_typescript => github.com/rynop/protoc-gen-twirp_typescript master
protoc-gen-twirp_typescript 是一个工具protoc
,所以这是我的tools.go
:
// +build tools
package tools
import (
// protocol buffer compiler plugins
_ "github.com/golang/protobuf/protoc-gen-go"
_ "github.com/mwitkow/go-proto-validators/protoc-gen-govalidators"
_ "github.com/twitchtv/twirp/protoc-gen-twirp"
_ "github.com/rynop/protoc-gen-twirp_typescript"
)
当我运行go mod tidy
下载我的依赖项时,我收到此错误:
go: finding github.com/rynop/protoc-gen-twirp_typescript master
go: finding github.com/rynop/protoc-gen-twirp_typescript latest
go: github.com/rynop/protoc-gen-twirp_typescript@v0.0.0-20190618203538-a346b5d9c8fb: parsing go.mod: unexpected module path "go.larrymyers.com/protoc-gen-twirp_typescript"
为什么我会收到此错误?我认为替换指令go.mod
允许分叉模块 go.mod保持不变。