Last active
November 10, 2020 03:11
-
-
Save cuongld2/bfbb1001520f9e96d153738f09f53faa to your computer and use it in GitHub Desktop.
Scan line maxCapacity
This file contains 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
scanner := bufio.NewScanner(file) | |
const maxCapacity = 512*1024 | |
buf := make([]byte, maxCapacity) | |
scanner.Buffer(buf, maxCapacity) | |
// The bufio.ScanLines is used as an | |
// input to the method bufio.Scanner.Split() | |
// and then the scanning forwards to each | |
// new line using the bufio.Scanner.Scan() | |
// method. | |
scanner.Split(bufio.ScanLines) | |
for scanner.Scan() { | |
if strings.Contains(scanner.Text(),geneBackupSymbol){ | |
i +=1 | |
data = append(data, []byte(scanner.Text())...) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment