Skip to content

Instantly share code, notes, and snippets.

View jeffotoni's full-sized avatar

Jefferson Otoni Lima jeffotoni

View GitHub Profile
package main
func main() {
println("Hello all folks!")
}
package main
import "fmt"
func sum(s []int, c chan int) {
sum := 0
for _, v := range s {
sum += v
}
c <- sum // send sum to c
ch <- v // Envia v para canalizar ch.
v: = <-ch // Receber de ch e
// atribui valor ao v.
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
package main
import "fmt"
import "time"
func worker(id int, jobs <-chan int, results chan<- int) {
for j := range jobs {
fmt.Println("worker", id, "started job", j)
time.Sleep(time.Second)
fmt.Println("worker", id, "finished job", j)
$ go mod init yourapp
$ go build
package main
import "fmt"
import "math"
type Gemetric interface {
area() float64
perim() float64
}
type Gemetric interface {
area() float64
perim() float64
}
package main
import "fmt"
func main() {
fmt.Printf("Olá, eu amo Go!\n")
}
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
//"log"
//"strconv"
)