如何在Github上设置Golang项目版本

时间:2019-07-19 07:52:55

标签: go dep

我创建一个Golang项目。使用dep作为依赖项管理。我可以介绍github.com/gin-gonic/gin v1.4.0,但是我不知道如何在我的项目中设置该版本。

我正在尝试创建功能。 git checkout -b bate-0.0.1

修改gopkg.toml文件时发生错误

Solving failure: No versions of github.com/sillyhatxu/go-utils met constraints:
        master: Could not introduce github.com/sillyhatxu/go-utils@master, as it is not allowed by constraint beta-0.0.1 from project aftersales-backend.
        beta-0.0.1: Could not introduce github.com/sillyhatxu/go-utils@beta-0.0.1, as it is not allowed by constraint beta-0.0.1 from project aftersales-backend.
[[constraint]]
  name = "github.com/sillyhatxu/go-utils"
  version = "beta-0.0.1"

1 个答案:

答案 0 :(得分:1)

我一直在解决此问题。 Golang使用git的标签功能进行版本控制。

git tag v0.0.1

git push origin --tags v0.0.1

Gopkg.toml

[[constraint]]
  name = "github.com/sillyhatxu/go-utils"
  version = "0.0.1"