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

Copy link
Member

@quasilyte quasilyte left a comment

Choose a reason for hiding this comment

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

LGTM. I like how docs look on the github preview. :)

@fexolm fexolm merged commit 10f6712 into master Jun 3, 2018
@fexolm fexolm deleted the docgen branch June 3, 2018 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants