Short:"do coverage profile diff analysis, it can also work with prow and post comments to github pull request if needed",
Example:`gocdiff--new-profile=<xxxx>--base-profile=<xxxx>// diff two local coverage profile and display
gocdiff--prow-postsubmit-job=<xxx>--new-profile=<xxx>// diff local coverage profile with the remote one in prow job using default qiniu-credential
gocdiff--prow-postsubmit-job=<xxx>--new-profile=<xxx>--full-diff=true// calculate and display full diff coverage between new-profile and base-profile, not concerned github changed files
--qiniu-credential=<xxx>--coverage-threshold-percentage=<xxx>--new-profile=<xxxx>// diff coverage profile with the remote one in prow job, and post comments to github PR
`,
Run:func(cmd*cobra.Command,args[]string){
ifbaseProfile!=""{
doDiffForLocalProfiles(cmd,args)
}elseifprowPostSubmitJob!=""{
doDiffUnderProw(cmd,args)
}else{
logrus.Fatalf("either base-profile or prow-postsubmit-job must be provided")
}
},
}
var(
newProfilestring
baseProfilestring
coverageThresholdint
prowPostSubmitJobstring
prowProfilestring
githubTokenstring
githubUserstring
githubCommentPrefixstring
qiniuCredentialstring
robotNamestring
fullDiffbool
)
funcinit(){
diffCmd.Flags().StringVarP(&newProfile,"new-profile","n","","local profile which works as the target to analysis")
diffCmd.MarkFlagRequired("new-profile")
diffCmd.Flags().StringVarP(&baseProfile,"base-profile","b","","another local profile which works as baseline to compare with the target")
diffCmd.Flags().StringVarP(&prowPostSubmitJob,"prow-postsubmit-job","","","prow postsubmit job which used to find the base profile")
diffCmd.Flags().StringVarP(&prowProfile,"prow-remote-profile-name","","filtered.cov","the name of profile in prow postsubmit job, which used as the base profile to compare")
diffCmd.Flags().StringVarP(&githubToken,"github-token","","/etc/github/oauth","path to token to access github repo")
diffCmd.Flags().StringVarP(&githubUser,"github-user","","","github user name when comments in github")
diffCmd.Flags().StringVarP(&githubCommentPrefix,"github-comment-prefix","","","specific comment flag you provided")
diffCmd.Flags().StringVarP(&qiniuCredential,"qiniu-credential","","/etc/qiniuconfig/qiniu.json","path to credential file to access qiniu cloud")
diffCmd.Flags().StringVarP(&robotName,"robot-name","","qiniu-bot","github user name for coverage robot")
diffCmd.Flags().BoolVarP(&fullDiff,"full-diff","",false,"when set true,calculate and display full diff coverage between new-profile and base-profile")