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 append_test
import "fmt"
func ExampleArrayToSlice() {
arr := []string{"a", "b", "c"}
//arr = append(arr, arr) // Compile error : cannot use arr (type []string) as type string in append
arr = append(arr, arr...)
package example_test
import (
"fmt"
"log"
"os"
"testing"
"text/scanner"
)
@atotto
atotto / README.md
Last active August 29, 2015 14:04
Set-User-ID Programs

Set-User-ID Programs

Advanced Programming in the UNIX® Environment Third Edition

SS 8.13

$ go build tsys.go
$ sudo chmod u+s tsys
@atotto
atotto / main.go
Created February 19, 2015 14:15
parallel
// http://play.golang.org/p/cwMSE2imEN
package main
import (
"errors"
"fmt"
"sync"
)
func main() {
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 {