This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ for WORKTIME in {1..5}0; do echo -n "$WORKTIME: "; ./timeout --timeout 25 --worktime $WORKTIME; done | |
10: Worker finished | |
20: Worker finished | |
30: Timeout | |
40: Timeout | |
50: Timeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type Gender int | |
const ( | |
Male Gender = iota |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 6g slice.go && sl -o slice slice.6 | |
slice.go:11: syntax error: unexpected }, expecting := or = or comma | |
$ 6g -V | |
6g version weekly.2011-07-07 9100+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"xml" | |
"bytes" | |
) | |
type Slice struct { | |
ID string "ident" // or `xml:"ident"` with a newish weekly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SubDirResponseWriter struct { | |
ResponseWriter | |
path string | |
} | |
func (w *SubDirResponseWriter) WriteHeader(code int) { | |
if code/100 == 3 { | |
loc := w.Header().Get("Location") | |
if len(loc) > 0 { | |
url := http.ParseURLReference(loc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
### Usage: blah [<options>] | |
### | |
### Description of the script | |
### | |
### Options: | |
### -f --flag | |
### Description of the flag | |
### -o --option <arg> | |
### Description of the option and argument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"http" | |
"flag" | |
"runtime" | |
"bytes" | |
"log" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include $(GOROOT)/src/Make.inc | |
TARG=l | |
DEP= | |
GOFILES=\ | |
main.go\ | |
pkgdir=$(GOROOT)/pkg/$(GOOS)_$(GOARCH) | |
PREREQ+=$(foreach PKG,$(DEP),$(pkgdir)/$(PKG).a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"path/filepath" | |
"fmt" | |
"log" | |
"os" | |
) | |
type visitor struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/tls" | |
"io" | |
"log" | |
) | |
func main() { | |
conn, err := tls.Dial("tcp", "127.0.0.1:8000", nil) |