Skip to content

Commit

Permalink
fixup: fix for comment
Browse files Browse the repository at this point in the history
Signed-off-by: 170210 <j170210@icloud.com>
  • Loading branch information
170210 committed Aug 8, 2023
1 parent 384316e commit d5e2d85
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Check generated error docs
run: |
make error-doc
make error-doc-gen
if ! git diff --stat --exit-code ; then
echo ">> ERROR:"
echo ">>"
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,9 @@ libsodium:
fi
.PHONY: libsodium

error-doc:
error-doc-gen:
cd ./tools/error_doc && go run ./
.PHONY: error-doc
.PHONY: error-doc-gen

###############################################################################
### release ###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ func NewErrorDocumentGenerator(p string) *ErrorDocumentGenerator {
}
}

func (edg *ErrorDocumentGenerator) listUpErrorsGoFiles(startPath, errorsFileName string) error {
err := filepath.Walk(startPath, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() && info.Name() == errorsFileName {
edg.errorsFiles = append(edg.errorsFiles, path)
}
return nil
})
if err != nil {
return err
}
return nil
}

func (edg *ErrorDocumentGenerator) extractModuleName() error {
for _, filepath := range edg.errorsFiles {
var moduleName string
Expand Down Expand Up @@ -75,10 +91,10 @@ func (edg *ErrorDocumentGenerator) generateContent() error {
for _, moduleName := range edg.modules {
mods := edg.errorDocument[moduleName]
for _, mod := range mods {
if err := mod.errorsFileParse(); err != nil {
if err := mod.parseErrorsFile(); err != nil {
return err
}
if err := mod.keysFileParse(); err != nil {
if err := mod.parseKeysFile(); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/error_doc/generator/errors_file_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func getConst(line string) (string, string, error) {
return "", "", errors.New("failed to get the value in: " + line)
}

func (mi *moduleInfo) errorsFileParse() error {
func (mi *moduleInfo) parseErrorsFile() error {
// var errorDict []errorInfo
// constDict := make(map[string]string)
file, err := os.Open(mi.filepath)
Expand Down
2 changes: 1 addition & 1 deletion tools/error_doc/generator/keys_file_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func getCodeSpace(line string) (string, string, error) {
return "", "", errors.New("failed to get the value in: " + line)
}

func (mi *moduleInfo) keysFileParse() error {
func (mi *moduleInfo) parseKeysFile() error {
// find keys.go or key.go
possibleFileNames := []string{"keys.go", "key.go"}
var keyFilePath string
Expand Down
22 changes: 0 additions & 22 deletions tools/error_doc/generator/module_directory_walker.go

This file was deleted.

0 comments on commit d5e2d85

Please sign in to comment.