Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add version flag test #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Fleezesd
Copy link

What type of PR is this?

/kind chore

What this PR does / why we need it:

fix version flag test

截屏2024-05-20 17 07 59

Copy link
Contributor

@colin404 colin404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

很赞的path,可以按着CR修改下。然后,我测下merge了

@@ -83,14 +96,21 @@ func AddFlags(fs *flag.FlagSet) {
fs.AddFlag(flag.Lookup(versionFlagName))
}

// variables for unit testing PrintAndExitIfRequested
var (
appName = "onex-apiserver"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不能写appName=“onex-apiserver”,这么一写,pkg/version包就跟onex项目的onex-apiserver耦合了。变成了一个非完全独立的Go包,version包也不适合放在pkg/目录下了。

@@ -39,6 +42,16 @@ func (v *versionValue) Set(s string) error {
*v = VersionRaw
return nil
}

if strings.HasPrefix(s, "v") {
err := version.SetDynamicVersion(s)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github.com/superproj/onex/pkg/version 有SetDynamicVersion,可以直接引用

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has been modified, thanks for review the code again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants