当前位置: 首页>>代码示例>>Golang>>正文


Golang Bug.SetDescription方法代码示例

本文整理汇总了Golang中github.com/driusan/bug/bugs.Bug.SetDescription方法的典型用法代码示例。如果您正苦于以下问题:Golang Bug.SetDescription方法的具体用法?Golang Bug.SetDescription怎么用?Golang Bug.SetDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/driusan/bug/bugs.Bug的用法示例。


在下文中一共展示了Bug.SetDescription方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: beImportBug

func beImportBug(identifier, issuesDir, fullbepath string) {
	/* BE appears to store the top level data of a bug
	   ins a json file named values with the format:
	    {
	        "creator": "Dave MacFarlane <[email protected]>",
	        "reporter": "Dave MacFarlane <[email protected]>",
	        "severity": "minor",
	        "status": "open",
	        "summary": "abc",
	        "time": "Tue, 12 Jan 2016 00:05:28 +0000"
	    }

	    and the description of bugs entirely in comments.
	    All we really care about is the summary so that we
	    can get the directory name for the issues/ directory,
	    but the severity+status can also be used as a status
	    to ensure that we have at least 1 file to be tracked
	    by git.
	*/

	type BeValues struct {
		Creator  string `json:creator`
		Reporter string `json:reporter`
		Severity string `json:severity`
		Status   string `json:status`
		Summary  string `json:summary`
		Time     string `json:time`
	}
	file := fullbepath + "/values"

	fmt.Printf("File: %s\n", file)
	data, _ := ioutil.ReadFile(file)
	var beBug BeValues
	err := json.Unmarshal([]byte(data), &beBug)
	if err != nil {
		fmt.Printf("Error unmarshalling data: %s\n", err.Error())
	}

	fmt.Printf("%s\n", beBug)

	bugdir := bugs.TitleToDir(beBug.Summary)

	b := bugs.Bug{bugs.Directory(issuesDir) + bugdir}
	if dir := b.GetDirectory(); dir != "" {
		os.Mkdir(string(dir), 0755)
	}
	if beBug.Status != "" && beBug.Severity != "" {
		b.SetStatus(beBug.Status + ":" + beBug.Severity)
	}

	comments := fullbepath + "/comments/"
	dir, err := os.Open(comments)

	files, err := dir.Readdir(-1)
	var Description string
	if len(files) > 0 && err == nil {
		for _, file := range files {
			if file.IsDir() {
				Description = Description + "\n" +
					beImportComments(b, comments+file.Name(), len(files) > 1)
			}
		}
	}
	b.SetDescription(Description)
	b.SetIdentifier(identifier)
}
开发者ID:Komosa,项目名称:bug,代码行数:66,代码来源:be.go


注:本文中的github.com/driusan/bug/bugs.Bug.SetDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。