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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"sync/atomic" | |
"time" | |
) | |
// In this example our state will be owned by a single |
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
// Simple example of sending multiple values on a channel of a custom type | |
package main | |
import ( | |
"fmt" | |
) | |
type num struct { | |
Num int |
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
numMap := map[string][]int{} | |
for i := 0; i <= 10; i++ { | |
numMap["numbers"] = append(numMap["numbers"], i) | |
} | |
fmt.Println(numMap) |