Skip to content

Instantly share code, notes, and snippets.

View atotto's full-sized avatar
🌏
Working from home

Ato Araki atotto

🌏
Working from home
View GitHub Profile
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
filepath.Walk("/tmp/", func(path string, info os.FileInfo, err error) error {
@atotto
atotto / eg.go
Last active December 11, 2015 07:58
package eg
func foo() string {
return "foo"
}
func Bar() string {
return "Bar"
}
package stringbuild_test
import (
"bytes"
"testing"
)
func StringBuild_bad() string {
str := ""
for i := 0; i < 1000; i++ {
@atotto
atotto / foo.go
Last active December 20, 2015 00:39
package main
import (
"github.com/golang/glog"
)
func foo() {
glog.Info("info v1")
glog.Error("error v1")
@atotto
atotto / main.go
Last active December 21, 2015 04:29
package main
import (
"fmt"
)
func main() {
fmt.Println("hello")
}
package main
import (
"fmt"
"path/filepath"
)
func main() {
matches, err := filepath.Glob("*/*.go")
if err != nil {
@atotto
atotto / goupdate
Created August 20, 2013 12:29
update script for golang
#!/bin/sh
cd `go env GOROOT`/src
echo "hg pull";hg pull
if [ "$?" -eq 0 ]
then
echo "OK"
#echo "hg update weekly";hg update weekly
echo "hg update release";hg update release
// You can define a version string using -ldflags and -X options.
// $ go run -ldflags "-X main.version 0.1" version.go
//
package main
import (
"fmt"
)
var version string
@atotto
atotto / Emacs
Created September 8, 2013 12:08
Emacs execution script on OS X
#!/bin/sh
## for OSX
## You can call Emacs on the terminal and use environment variables of your shell.
open -a Emacs --args $@
@atotto
atotto / example_test.go
Last active February 5, 2018 14:36
golang panic-recover example
package example
import (
"fmt"
"reflect"
)
func ExamplePanic() {
err := Counter("hoge")