2018-05-27 22:40:42 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
2018-06-22 21:45:12 +08:00
|
|
|
"fmt"
|
2018-05-27 22:40:42 +08:00
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func concat(a bytes.Buffer, b bytes.Buffer) []byte {
|
|
|
|
return append(a.Bytes(), b.Bytes()...)
|
|
|
|
}
|
|
|
|
|
2019-02-19 00:23:44 +08:00
|
|
|
func nameFromEmail(email string) string {
|
|
|
|
for i, c := range email {
|
|
|
|
if c == '@' {
|
|
|
|
return email[:i]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return email
|
|
|
|
}
|
|
|
|
|
2018-05-27 22:40:42 +08:00
|
|
|
func exitIfError(err error) {
|
|
|
|
if err != nil {
|
2018-06-22 21:45:12 +08:00
|
|
|
fmt.Printf("fatal error: %v\n", err)
|
2018-05-27 22:40:42 +08:00
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|