Created
March 16, 2019 10:07
-
-
Save brpaz/c0ea4b600ff3743638f2e2fb35eb5255 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func scanFile() { | |
f, err := os.OpenFile(logfile, os.O_RDONLY, os.ModePerm) | |
if err != nil { | |
log.Fatalf("open file error: %v", err) | |
return | |
} | |
defer f.Close() | |
sc := bufio.NewScanner(f) | |
for sc.Scan() { | |
_ = sc.Text() // GET the line string | |
} | |
if err := sc.Err(); err != nil { | |
log.Fatalf("scan file error: %v", err) | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment