Skip to content

Commit

Permalink
replace seeker with scanner to handle crlf/lf differences on OSs.
Browse files Browse the repository at this point in the history
Turns out, git replaces the line endings for you, and go install uses git under the hood
  • Loading branch information
JeremyLoy committed Jan 22, 2022
1 parent a312d23 commit c8e3df9
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions termle.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"embed"
"flag"
"fmt"
"io"
"math/rand"
"os"
"regexp"
Expand Down Expand Up @@ -229,17 +228,11 @@ func answerForDay(day int) string {
panic(err)
}
defer answersFile.Close()
seeker := answersFile.(io.ReadSeeker)
_, err = seeker.Seek(int64(day*7), io.SeekStart)
if err != nil {
panic(err)
}
answer := make([]byte, 5)
_, err = seeker.Read(answer)
if err != nil {
panic(err)
s := bufio.NewScanner(answersFile)
for i := 0; i <= day; i++ {
s.Scan()
}
return strings.ToUpper(string(answer))
return strings.ToUpper(s.Text())
}

func daysSinceFirstWordle() int {
Expand Down

0 comments on commit c8e3df9

Please sign in to comment.