Advanced Programming in the UNIX® Environment Third Edition
SS 8.13
$ go build tsys.go
$ sudo chmod u+s tsys
// $ go tool vet *.go | |
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
//fmt.Printf("hello %s", "世界") |
package chan_test | |
import ( | |
"testing" | |
) | |
func BenchmarkStructChan(b *testing.B) { | |
ch := make(chan struct{}) | |
go func() { | |
for { |
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" | |
) |
package example_test | |
import ( | |
"os" | |
"testing" | |
) | |
func TestA(t *testing.T) { | |
} |
// http://play.golang.org/p/cwMSE2imEN | |
package main | |
import ( | |
"errors" | |
"fmt" | |
"sync" | |
) | |
func main() { |
FROM golang:1.5 | |
MAINTAINER gophers | |
ENV GOPATH=/workspace | |
ENV PATH=$GOPATH/bin:$PATH | |
RUN mkdir /workspace | |
RUN ["go", "version"] | |
EXPOSE 6060 |
#!/bin/bash -e | |
# usage | |
# $0 path/to/go/built/binary | |
usage() { | |
echo "Usage" | |
echo " $0 path/to/go/built/binary" | |
exit 2 | |
} |
#!/bin/sh | |
# $ wget http://www.gniibe.org/oitoite/ac-power-control-by-USB-hub/hub-ctrl.c | |
# $ gcc -O2 -o hub-ctrl hub-ctrl.c -lusb | |
# $ sudo chown root:$USER hub-ctrl | |
# $ sudo chmod +s hub-ctrl | |
# $ mv hub-ctrl ~/bin | |
usage() { | |
echo "Usage: $0 (on|off)" |