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 ( | |
"encoding/csv" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
) |
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
5+5 | 10 | |
---|---|---|
7+3 | 10 | |
1+1 | 2 | |
8+3 | 11 | |
1+2 | 3 | |
8+6 | 14 | |
3+1 | 4 | |
1+4 | 5 | |
5+1 | 6 | |
2+3 | 5 |
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
# The event key is required for nginx | |
events{ | |
worker_connections 1024; | |
} | |
http { | |
server { | |
listen 8080; | |
# location is the key for your endpoint to access nginx configurarion | |
# example: curl -v http://localhost:8080/ will access this location |
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
events{ | |
worker_connections 1024; | |
} | |
http { | |
# A shared memory zone to keep cache | |
proxy_cache_path /etc/nginx/cache keys_zone=mycache:10m; | |
server { | |
listen 8080; |
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
events{ | |
worker_connections 1024; | |
} | |
http { | |
# A shared memory zone to keep cache | |
proxy_cache_path /etc/nginx/cache keys_zone=mycache:10m inactive=10m; | |
server { | |
listen 8080; |
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" | |
"os" | |
"time" | |
) | |
func timer() { | |
// Cria um ticker, um relógio que retorna um channel com o tempo atual, |
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" | |
"net/http" | |
) | |
func main() { | |
http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprint(w, "Hello my friend") |
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
var i int // 0 | |
var f float64 // 0.0 | |
var b bool // false | |
var s string // "" | |
fmt.Printf("%v %v %v %q\n", i, f, b, s) | |
// nil for interfaces, slices, channels, maps, pointers and functions. | |
var pa *Student // pa == nil | |
pa = new(Student) // pa == &Student{"", 0} | |
pa.Name = "Alice" // pa == &Student{"Alice", 0} |
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
func status() func() string { | |
var index int | |
orderStatus := map[int]string{ | |
1: "TO DO", | |
2: "DOING", | |
3: "DONE", | |
} | |
// Retorna função que tem acesso à todo o escopo | |
// da função status, portanto também pode atualizar | |
// o valor da variável index |
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
func main() { | |
sayHi := func() { | |
fmt.Println("HIIIIIII!") | |
} | |
sayHi() | |
var sayBye func(name string) | |
sayBye = func(n string) { | |
fmt.Printf("Bye %s", n) | |
} |
OlderNewer