Solution: Introduction to Go
Let’s solve the challenges set in the previous lesson.
We'll cover the following...
We'll cover the following...
Problem 1: Solution
To find all possible occurrences of the desired executable, we can make the following changes to the which.go code:
Declare a
resultsvariable of type[]stringto store all the full paths of the executable.Inside the
forloop, after finding an executable, instead of returning immediately, append the full path of the executable to theresultsvariable.After the first
forloop, use anotherforloop to iterate over theresultsvariable and print all the ...