go get on forked github repo got “unexpected module path” error

后端 未结 1 568
盖世英雄少女心
盖世英雄少女心 2021-01-12 14:56

I\'m currently working something on AWS Cloudformation which using this repo https://github.com/awslabs/goformation. Because I did some customise so I made a fork https://gi

1条回答
  •  隐瞒了意图╮
    2021-01-12 15:28

    You can use replace in your go.mod to use a fork instead of the upstream version. That way, you can make whatever modifications you need to the code without having to update the module path or import paths.

    To be specific, in this case, you can do the following in your go.mod (I tested this by forking the repo, making a small change, and confirming it showed up):

    require github.com/awslabs/goformation v1.4.1
    
    replace github.com/awslabs/goformation => github.com/vrealzhou/goformation master
    

    The first time you build or test, master will be replaced by the latest pseudo-version for your fork to make sure you get repeatable builds. The replace requires a specific version for the replacement.

    0 讨论(0)
提交回复
热议问题