Skip to content

Commit

Permalink
fix open files exceeded for rss.go
Browse files Browse the repository at this point in the history
Fixes: #11
Signed-off-by: Moritz Poldrack <[email protected]>
  • Loading branch information
mpldr authored and donuts-are-good committed Mar 4, 2023
1 parent 97173f5 commit 0e1c218
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions rss.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ type RSSFeed struct {
}

func CreateXMLRSSFeed(inFolder, outFolder string) {

// get the posts we have
files, _ := os.ReadDir(inFolder)

// most recently modified file comes first
sort.Slice(files, func(i, j int) bool {

// get info for each file in the list
fi, _ := os.Stat(inFolder + "/" + files[i].Name())
fj, _ := os.Stat(inFolder + "/" + files[j].Name())
Expand Down Expand Up @@ -71,10 +69,10 @@ func CreateXMLRSSFeed(inFolder, outFolder string) {
if err != nil {
continue
}
defer markdownFile.Close()

reader := bufio.NewReader(markdownFile)
markdown, err := io.ReadAll(reader)
markdownFile.Close()
if err != nil {
continue
}
Expand Down

0 comments on commit 0e1c218

Please sign in to comment.