當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Version.Pre方法代碼示例

本文整理匯總了Golang中github.com/blang/semver.Version.Pre方法的典型用法代碼示例。如果您正苦於以下問題:Golang Version.Pre方法的具體用法?Golang Version.Pre怎麽用?Golang Version.Pre使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/blang/semver.Version的用法示例。


在下文中一共展示了Version.Pre方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Apply

func (bump PreBump) Apply(v semver.Version) semver.Version {
	if v.Pre == nil || v.Pre[0].VersionStr != bump.Pre {
		v.Pre = []semver.PRVersion{
			{VersionStr: bump.Pre},
			{VersionNum: 1, IsNum: true},
		}
	} else {
		v.Pre = []semver.PRVersion{
			{VersionStr: bump.Pre},
			{VersionNum: v.Pre[1].VersionNum + 1, IsNum: true},
		}
	}

	return v
}
開發者ID:xtreme-sameer-vohra,項目名稱:semver-resource,代碼行數:15,代碼來源:pre_bump.go

示例2:

			Major: 1,
			Minor: 2,
			Patch: 3,
		}

		bump = version.PreBump{}
	})

	JustBeforeEach(func() {
		outputVersion = bump.Apply(inputVersion)
	})

	Context("when the version is a prerelease", func() {
		BeforeEach(func() {
			inputVersion.Pre = []semver.PRVersion{
				{VersionStr: "alpha"},
				{VersionNum: 1, IsNum: true},
			}
		})

		Context("when the bump is the same prerelease type", func() {
			BeforeEach(func() {
				bump.Pre = "alpha"
			})

			It("bumps the prerelease version number", func() {
				Expect(outputVersion).To(Equal(semver.Version{
					Major: 1,
					Minor: 2,
					Patch: 3,
					Pre: []semver.PRVersion{
						{VersionStr: "alpha"},
開發者ID:xtreme-sameer-vohra,項目名稱:semver-resource,代碼行數:32,代碼來源:pre_bump_test.go

示例3: Apply

func (MinorBump) Apply(v semver.Version) semver.Version {
	v.Minor++
	v.Patch = 0
	v.Pre = nil
	return v
}
開發者ID:xtreme-sameer-vohra,項目名稱:semver-resource,代碼行數:6,代碼來源:minor_bump.go

示例4: Apply

func (FinalBump) Apply(v semver.Version) semver.Version {
	v.Pre = nil
	return v
}
開發者ID:xtreme-sameer-vohra,項目名稱:semver-resource,代碼行數:4,代碼來源:final_bump.go

示例5:

			Context(fmt.Sprintf("when bumping %s", bumpLocal), func() {
				BeforeEach(func() {
					bumpParam = bumpLocal
				})

				It("bumps to "+resultLocal, func() {
					Ω(version.String()).Should(Equal(resultLocal))
				})
			})
		}

		Context("when it's already a prerelease", func() {
			BeforeEach(func() {
				version.Pre = []semver.PRVersion{
					{VersionStr: "rc"},
					{VersionNum: 1, IsNum: true},
				}
			})

			for bump, result := range map[string]string{
				"":      "1.2.3-rc.2",
				"final": "1.2.3-rc.1",
				"patch": "1.2.4-rc.1",
				"minor": "1.3.0-rc.1",
				"major": "2.0.0-rc.1",
			} {
				bumpLocal := bump
				resultLocal := result

				Context(fmt.Sprintf("when bumping %s", bumpLocal), func() {
					BeforeEach(func() {
開發者ID:xtreme-sameer-vohra,項目名稱:semver-resource,代碼行數:31,代碼來源:bump_from_params_test.go

示例6: Apply

func (PatchBump) Apply(v semver.Version) semver.Version {
	v.Patch++
	v.Pre = nil
	return v
}
開發者ID:xtreme-sameer-vohra,項目名稱:semver-resource,代碼行數:5,代碼來源:patch_bump.go


注:本文中的github.com/blang/semver.Version.Pre方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。