For Go projects that consist of only one package, the following Travis configuration is enough to get started with coveralls.io. You may want to encrypt your $COVERALLS_TOKEN
via Travis encryption keys though.
language: go
go:
- 1.3.1
For Go projects that consist of only one package, the following Travis configuration is enough to get started with coveralls.io. You may want to encrypt your $COVERALLS_TOKEN
via Travis encryption keys though.
language: go
go:
- 1.3.1
package resources | |
import ( | |
"net/http/httptest" | |
"strings" | |
"testing" | |
mocket "github.com/Selvatico/go-mocket" | |
"github.com/jinzhu/gorm" | |
"github.com/labstack/echo" |
import ( | |
"crypto/md5" | |
"encoding/hex" | |
) | |
func GetMD5Hash(text string) string { | |
hasher := md5.New() | |
hasher.Write([]byte(text)) | |
return hex.EncodeToString(hasher.Sum(nil)) | |
} |
/* | |
This is a go program to download pictures from a tumblr blog page. | |
To Build: | |
go build -o tumblr-download tumblr-download.go | |
To Run: | |
# download the photos on the first page of tumblr blog |
// Example program that uses blakjack/webcam library | |
package main | |
import ( | |
"fmt" | |
"os" | |
"github.com/blackjack/webcam" | |
) |
type reader struct { | |
r io.Reader | |
err error | |
} | |
func (r *reader) read(data interface{}) { | |
if r.err == nil { | |
r.err = binary.Read(r.r, binary.BigEndian, data) | |
} | |
} |
b := make([]byte, os.Getpagesize()) |
$ cat /proc/sys/fs/file-max
If the limit is lower than your desired value, open the /etc/sysctl.conf
and add this line at the end of file:
fs.file-max = 65536
package main | |
import ( | |
"log" | |
"net/smtp" | |
) | |
func main() { | |
send("hello there") | |
} |
Опасная ловушка при работе с интерфейсами в Go.
Описание тут https://github.com/golang/go/wiki/MethodSets
Так работает. Запустить.
package main
import "fmt"