【发布时间】:2019-11-02 09:33:06
【问题描述】:
我 forked 是一个 go 模块,并且想在我的项目中使用通过 v1.12 使用 versioned modules 的 fork。我的代码不在我的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 中的replace 指令允许forked modules go.mod 保持不变。
【问题讨论】:
标签: go protocol-buffers protoc go-modules