:(){ :|:& };:
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" | |
type Mutatable struct { | |
a int | |
b int | |
} | |
func (m Mutatable) UpdateReceiver() { |
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() { | |
tempDirs := []string{"one", "two", "three", "four", "five"} | |
var rmdirs []func() | |
for _, dir := range tempDirs { | |
// Without this `dir := dir` line rmdir func would use outer `dir` |
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" | |
type T struct{ X int } | |
// mutable | |
func inc1(t *T) { | |
t.X++ | |
} |
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" | |
"log" | |
"math/rand" | |
"net/http" | |
"time" | |
"github.com/prometheus/client_golang/prometheus" |
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" | |
// Generate primes and send them to channel `ch` | |
func Generate(ch chan<- int) { | |
for i := 2; ; i++ { | |
ch <- i | |
} | |
} |
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
pp := new(Point) | |
*pp = Point{1, 2} | |
// is equvalent to | |
pp := &Point{1, 2} |
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" | |
var graph = make(map[string]map[string]bool) | |
func addEdge(from, to string) { | |
edges := graph[from] | |
if edges == nil { | |
edges = make(map[string]bool) |
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
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: gateway | |
annotations: | |
kubernetes.io/ingress.class: "istio" | |
spec: | |
rules: | |
- http: | |
paths: |
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 "image" | |
import "image/gif" | |
import "os" | |
func main() { | |
files := os.Args[1:] | |
// files := []string{"g1.gif", "g2.gif","g3.gif", "g2.gif"} |