Trim instruction before parse
This commit is contained in:
16
main.go
16
main.go
@@ -54,7 +54,7 @@ func main() {
|
||||
log.Printf("Recurse: %s", *recurse)
|
||||
log.Printf("File: %s", *file)
|
||||
|
||||
instructions := make(chan LinkInstruction, 1000)
|
||||
instructions := make(chan *LinkInstruction, 1000)
|
||||
status := make(chan error)
|
||||
if *recurse != "" {
|
||||
go ReadFromFilesRecursively(*recurse, instructions, status)
|
||||
@@ -110,7 +110,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func ReadFromFilesRecursively(input string, output chan LinkInstruction, status chan error) {
|
||||
func ReadFromFilesRecursively(input string, output chan *LinkInstruction, status chan error) {
|
||||
defer close(output)
|
||||
defer close(status)
|
||||
|
||||
@@ -165,7 +165,7 @@ func ReadFromFilesRecursively(input string, output chan LinkInstruction, status
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
func ReadFromFile(input string, output chan LinkInstruction, status chan error, doclose bool) {
|
||||
func ReadFromFile(input string, output chan *LinkInstruction, status chan error, doclose bool) {
|
||||
if doclose {
|
||||
defer close(output)
|
||||
defer close(status)
|
||||
@@ -189,10 +189,10 @@ func ReadFromFile(input string, output chan LinkInstruction, status chan error,
|
||||
continue
|
||||
}
|
||||
log.Printf("Read instruction: %s", instruction.String())
|
||||
output <- instruction
|
||||
output <- &instruction
|
||||
}
|
||||
}
|
||||
func ReadFromArgs(output chan LinkInstruction, status chan error) {
|
||||
func ReadFromArgs(output chan *LinkInstruction, status chan error) {
|
||||
defer close(output)
|
||||
defer close(status)
|
||||
|
||||
@@ -203,10 +203,10 @@ func ReadFromArgs(output chan LinkInstruction, status chan error) {
|
||||
log.Printf("Error parsing arg: %s'%s'%s, error: %s%+v%s", SourceColor, arg, DefaultColor, ErrorColor, err, DefaultColor)
|
||||
continue
|
||||
}
|
||||
output <- instruction
|
||||
output <- &instruction
|
||||
}
|
||||
}
|
||||
func ReadFromStdin(output chan LinkInstruction, status chan error) {
|
||||
func ReadFromStdin(output chan *LinkInstruction, status chan error) {
|
||||
defer close(output)
|
||||
defer close(status)
|
||||
|
||||
@@ -227,7 +227,7 @@ func ReadFromStdin(output chan LinkInstruction, status chan error) {
|
||||
log.Printf("Error parsing line: %s'%s'%s, error: %s%+v%s", SourceColor, line, DefaultColor, ErrorColor, err, DefaultColor)
|
||||
continue
|
||||
}
|
||||
output <- instruction
|
||||
output <- &instruction
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
log.Fatalf("Error reading from stdin: %s%+v%s", ErrorColor, err, DefaultColor)
|
||||
|
Reference in New Issue
Block a user