Skip to content

Commit

Permalink
fixup! Add default lazygit config generator for Config.md from JSON s…
Browse files Browse the repository at this point in the history
…chema
  • Loading branch information
stefanhaller committed May 19, 2024
1 parent fa16009 commit dd9f158
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/jsonschema/generate_config_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package jsonschema
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"os"
"strings"
Expand Down Expand Up @@ -162,7 +163,7 @@ func getDefault(v *orderedmap.OrderedMap) (error, any) {
}
}

return fmt.Errorf("Failed to get default value"), nil
return errors.New("Failed to get default value"), nil
}

func parseNode(parent *Node, name string, value *orderedmap.OrderedMap) {
Expand Down Expand Up @@ -200,12 +201,12 @@ func writeToConfigDocs(config []byte) error {

startConfigSectionIndex := bytes.Index(markdown, []byte(DocumentationCommentStart))
if startConfigSectionIndex == -1 {
return fmt.Errorf("Default config starting comment not found, %w", err)
return errors.New("Default config starting comment not found")
}

endConfigSectionIndex := bytes.Index(markdown[startConfigSectionIndex+DocumentationCommentStartLen:], []byte(DocumentationCommentEnd))
if endConfigSectionIndex == -1 {
return fmt.Errorf("Default config closing comment not found %w", err)
return errors.New("Default config closing comment not found")
}

endConfigSectionIndex = endConfigSectionIndex + startConfigSectionIndex + DocumentationCommentStartLen
Expand Down

0 comments on commit dd9f158

Please sign in to comment.