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 waitForAction(d time.Duration) { | |
| input := make(chan bool, 1) | |
| // Start a goroutine to wait for user input | |
| go func() { | |
| fmt.Printf("\nPress Enter to exit immediately, or wait %v...\n", d) | |
| fmt.Scanln() // Wait for user to press Enter | |
| input <- true | |
| }() |
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
| package distance | |
| import ( | |
| "fmt" | |
| "strings" | |
| ) | |
| // A distance matrix | |
| // Optimised for storage efficiency. | |
| // Zero value can be used immediately. |