Skip to content

Instantly share code, notes, and snippets.

View tmonteiro's full-sized avatar

Tiago Monteiro tmonteiro

  • Matão/SP - Brasil
View GitHub Profile
@tmonteiro
tmonteiro / go_functional.go
Last active June 10, 2019 20:27 — forked from jakecoffman/go_functional.go
Example of functional programming in Golang.
package main
import "fmt"
func main() {
sum := Sum(1, 2, 3, 4)
fmt.Println(sum)
}
type any interface{}
@tmonteiro
tmonteiro / goAsync.go
Created May 4, 2019 23:24
Go routines async
package main
import (
"errors"
"sync"
)
func test(i int) (int, error) {
if i > 2 {
return 0, errors.New("test error")
@tmonteiro
tmonteiro / testing_http_resquests.go
Last active April 30, 2019 01:01
Testing http requests in golang
//https://github.com/campoy/justforfunc/tree/master/16-testing
package main
import (
"io"
"net/http"
"net/http/httptest"
"testing"
)
@tmonteiro
tmonteiro / xml-parsing.go
Created April 26, 2019 01:34
Parsing XML data into JSON in Golang
package main
import (
"encoding/json"
"encoding/xml"
"fmt"
)
type Employees struct {
XMLName xml.Name `xml:"http://employees/employee/e1 employees" json:"-"`