Skip to content

Conversation

fexolm
Copy link
Contributor

@fexolm fexolm commented Jun 3, 2018

fixes #132

@quasilyte
Copy link
Member

Is cmd/makedocs/makedocs binary file required?

package main

import (
"html/template"
Copy link
Member

Choose a reason for hiding this comment

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

You should probably use text/template.
This way, there shouldn't be any weird escaping problems in the output.

docs/overview.md Outdated

**After**
```go
x := xs[i+1]
Copy link
Member

Choose a reason for hiding this comment

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

These escaped sequences are probably there due to html/template usage.

Checkers []checker
}{
Checkers: checkers,
})
Copy link
Member

Choose a reason for hiding this comment

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

You can use bytes.Buffer for tmpl.Execute and then do ioutil.WriteFile.
This way, you don't need to mess around OpenFile and it's flags, you don't need to close file either.

}
if err != nil {
log.Fatal(err)
}
Copy link
Member

Choose a reason for hiding this comment

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

What error does it check?
Seems like these 3 lines are not needed here.

if err != nil {
log.Fatal(err)
}
ioutil.WriteFile(docsPath+"overview.md", buf.Bytes(), 0600)
Copy link
Member

Choose a reason for hiding this comment

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

- ioutil.WriteFile(docsPath+"overview.md", buf.Bytes(), 0600)
+ if err := ioutil.WriteFile(docsPath+"overview.md", buf.Bytes(), 0600); err != nil {
+ 	log.Fatalf("write output file: %v", err)
+ }

if err != nil {
return "", err
}
return string(b), nil
Copy link
Member

Choose a reason for hiding this comment

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

-	if err != nil {
-		return "", err
-	}
-	return string(b), nil
+	return string(b), err