Fix some Go Lint errors
authorbep <bjorn.erik.pedersen@gmail.com>
Fri, 6 Mar 2015 14:58:14 +0000 (15:58 +0100)
committerbep <bjorn.erik.pedersen@gmail.com>
Fri, 6 Mar 2015 14:58:14 +0000 (15:58 +0100)
bufferpool/bufpool.go
commands/convert.go

index 0b7829b2cf117d867099af2c4b97770aad557cff..5a550e0e7cbec0c7c40c500f91c19b57fbc32288 100644 (file)
@@ -24,10 +24,13 @@ var bufferPool = &sync.Pool{
        },
 }
 
+// GetBuffer returns a buffer from the pool.
 func GetBuffer() (buf *bytes.Buffer) {
        return bufferPool.Get().(*bytes.Buffer)
 }
 
+// PutBuffer returns a buffer to the pool.
+// The buffer is reset before it is put back into circulation.
 func PutBuffer(buf *bytes.Buffer) {
        buf.Reset()
        bufferPool.Put(buf)
index ec6e2e5518dd3f19dfd706a306a1209f61ba3cb1..6268fb2a2367c3555bd196eb004ffe43f3fab1b9 100644 (file)
@@ -27,8 +27,8 @@ import (
        "github.com/spf13/viper"
 )
 
-var OutputDir string
-var Unsafe bool
+var outputDir string
+var unsafe bool
 
 var convertCmd = &cobra.Command{
        Use:   "convert",
@@ -80,8 +80,8 @@ func init() {
        convertCmd.AddCommand(toJSONCmd)
        convertCmd.AddCommand(toTOMLCmd)
        convertCmd.AddCommand(toYAMLCmd)
-       convertCmd.PersistentFlags().StringVarP(&OutputDir, "output", "o", "", "filesystem path to write files to")
-       convertCmd.PersistentFlags().BoolVar(&Unsafe, "unsafe", false, "enable less safe operations, please backup first")
+       convertCmd.PersistentFlags().StringVarP(&outputDir, "output", "o", "", "filesystem path to write files to")
+       convertCmd.PersistentFlags().BoolVar(&unsafe, "unsafe", false, "enable less safe operations, please backup first")
 }
 
 func convertContents(mark rune) (err error) {
@@ -134,10 +134,10 @@ func convertContents(mark rune) (err error) {
                page.SetSourceContent(psr.Content())
                page.SetSourceMetaData(metadata, mark)
 
-               if OutputDir != "" {
-                       page.SaveSourceAs(filepath.Join(OutputDir, page.FullFilePath()))
+               if outputDir != "" {
+                       page.SaveSourceAs(filepath.Join(outputDir, page.FullFilePath()))
                } else {
-                       if Unsafe {
+                       if unsafe {
                                page.SaveSource()
                        } else {
                                jww.FEEDBACK.Println("Unsafe operation not allowed, use --unsafe or set a different output path")