本文整理匯總了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)
}