code
stringlengths
10
1.34M
language
stringclasses
1 value
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "log" "net/http" "time" ) const ( numPollers = 2 // number of Poller goroutines to launch pollInterval = 60 * ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package query type Conn string func (c Conn) DoQuery(query string) Result { return Result("result") } type Result string func Query(conns []Conn, query stri...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "encoding/json" "log" "reflect" ) type Message struct { Name string Body string Time int64 } // STOP OMIT func Encode() { m := ...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "fmt" type ByteSize float64 const ( _ = iota // ignore first value by assigning to blank identifier KB ByteSize = 1 << (10 * ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package rand2 /* #include <stdlib.h> */ import "C" func Random() int { var r C.long = C.random() return int(r) } // STOP OMIT func Seed(i int) { C.srandom(...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "image" ) func main() { r := image.Rect(2, 1, 5, 5).Add(image.Pt(-4, -2)) fmt.Println(r.Dx(), r.Dy(), image.Pt(0, 0).In(r)) //...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code snippets included in "Error Handling and Go." package main import ( "net/http" "text/template" ) type appError struct { Err...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code snippets included in "Error Handling and Go." package main import ( "net/http" "text/template" ) func init() { http.HandleF...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code snippets included in "Defer, Panic, and Recover." package main import ( "fmt" "io" "os" ) func a() { i := 0 defer fmt.Pri...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "image" ) func main() { m0 := image.NewRGBA(image.Rect(0, 0, 8, 5)) m1 := m0.SubImage(image.Rect(1, 2, 5, 5)).(*image.RGBA) f...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package print // #include <stdio.h> // #include <stdlib.h> import "C" import "unsafe" func Print(s string) { cs := C.CString(s) defer C.free(unsafe.Pointer(c...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "image" ) func main() { r := image.Rect(0, 0, 4, 3).Intersect(image.Rect(2, 2, 5, 5)) // Size returns a rectangle's width and ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "encoding/json" "log" "reflect" ) type FamilyMember struct { Name string Age int Parents []string } // STOP OMIT func Dec...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains examples to embed in the Go 1 release notes document. package main import ( "errors" "flag" "fmt" "log" "os" "path/filepath" "tes...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code snippets included in "The Laws of Reflection." package main import ( "bufio" "bytes" "io" "os" ) type MyInt int var i int...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package timeout import ( "time" ) func Timeout() { ch := make(chan bool, 1) timeout := make(chan bool, 1) go func() { time.Sleep(1 * time.Second) timeo...
Go
package main import ( "flag" "log" "net/http" "text/template" ) var addr = flag.String("addr", ":1718", "http service address") // Q=17, R=18 var templ = template.Must(template.New("qr").Parse(templateStr)) func main() { flag.Parse() http.Handle("/", http.HandlerFunc(QR)) err := http.ListenAndServe(*addr, ni...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code snippets included in "The Laws of Reflection." package main import ( "fmt" "reflect" ) func main() { var x float64 = 3.4 f...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package print // #include <stdio.h> // #include <stdlib.h> import "C" import "unsafe" func Print(s string) { cs := C.CString(s) C.fputs(cs, (*C.FILE)(C.stdou...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "image" ) func main() { r := image.Rect(2, 1, 5, 5) // Dx and Dy return a rectangle's width and height. fmt.Println(r.Dx(), r...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "image" "image/color" ) func main() { m := image.NewRGBA(image.Rect(0, 0, 640, 480)) m.Set(5, 5, color.RGBA{255, 0, 0, 255}) ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code snippets included in "Error Handling and Go." package main import ( "encoding/json" "errors" "fmt" "log" "net" "os" "tim...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "math" ) func InterfaceExample() { var i interface{} i = "a string" i = 2011 i = 2.777 // STOP OMIT r := i.(float64) fm...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "encoding/json" "log" "os" ) func main() { dec := json.NewDecoder(os.Stdin) enc := json.NewEncoder(os.Stdout) for { var v map[st...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code snippets included in "The Go image/draw package." package main import ( "image" "image/color" "image/draw" ) func main() { ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "io/ioutil" "regexp" ) func AppendByte(slice []byte, data ...byte) []byte { m := len(slice) n := m + len(data) if n > cap(slice) { ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code snippets included in "Error Handling and Go." package main import ( "net/http" "text/template" ) func init() { http.Handle(...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains the code snippets included in "Defer, Panic, and Recover." package main import "fmt" import "io" // OMIT import "os" // OMIT func main(...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "bytes" "encoding/gob" "fmt" "log" ) type P struct { X, Y, Z int Name string } type Q struct { X, Y *int32 Name string } fu...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package rand /* #include <stdlib.h> */ import "C" // STOP OMIT func Random() int { return int(C.random()) } // STOP OMIT func Seed(i int) { C.srandom(C.uint...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "encoding/json" "fmt" "log" "reflect" ) func Decode() { b := []byte(`{"Name":"Wednesday","Age":6,"Parents":["Gomez","Morticia"]}`) ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "image" ) func main() { p := image.Point{2, 1} fmt.Println("X is", p.X, "Y is", p.Y) }
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "sort" ) func main() { seq := Sequence{6, 2, -1, 44, 16} sort.Sort(seq) fmt.Println(seq) } type Sequence []int // Methods r...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package gobs1 type T struct{ X, Y, Z int } // Only exported fields are encoded and decoded. var t = T{X: 7, Y: 0, Z: 8} // STOP OMIT type U struct{ X, Y *int...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "html/template" "io/ioutil" "net/http" "regexp" ) type Page struct { Title string Body []byte } func (p *Page) save() error { f...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "errors" "html/template" "io/ioutil" "net/http" "regexp" ) type Page struct { Title string Body []byte } func (p *Page) save() ...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "html/template" "io/ioutil" "net/http" ) type Page struct { Title string Body []byte } func (p *Page) save() error { filename :=...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "bytes" "flag" "go/ast" "go/parser" "go/printer" "go/token" "log" "os" "text/template" ) var ( srcFn = flag.String("src", ""...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "io/ioutil" "net/http" ) type Page struct { Title string Body []byte } func (p *Page) save() error { filename := p.Title +...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "flag" "fmt" "io" "log" "net" "net/http" "os" "strings" ) var ( post = flag.String("post", "", "urlencoded form data to POST") ...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "html/template" "io/ioutil" "net/http" "regexp" ) type Page struct { Title string Body []byte } func (p *Page) save() error { f...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "io/ioutil" "net/http" ) type Page struct { Title string Body []byte } func (p *Page) save() error { filename := p.Title +...
Go
package main import ( "fmt" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:]) } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "io/ioutil" ) type Page struct { Title string Body []byte } func (p *Page) save() error { filename := p.Title + ".txt" ret...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "io/ioutil" ) type Page struct { Title string Body []byte } func (p *Page) save() error { filename := p.Title + ".txt" ret...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "io/ioutil" "os" "text/template" ) func main() { b, _ := ioutil.ReadAll(os.Stdin) template.HTMLEscape(os.Stdout, b) }
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "html/template" "io/ioutil" "net/http" ) type Page struct { Title string Body []byte } func (p *Page) save() error { filename :=...
Go
package main import "fmt" func main() { fmt.Println("Hello, 世界") }
Go
// Go's concurrency primitives make it easy to // express concurrent concepts, such as // this binary tree comparison. // // Trees may be of different shapes, // but have the same contents. For example: // // 4 6 // 2 6 4 7 // 1 3 5 7 2 5 // 1 3 // ...
Go
package main // fib returns a function that returns // successive Fibonacci numbers. func fib() func() int { a, b := 0, 1 return func() int { a, b = b, a+b return a } } func main() { f := fib() // Function calls are evaluated left-to-right. println(f(), f(), f(), f(), f()) }
Go
// A concurrent prime sieve package main // Send the sequence 2, 3, 4, ... to channel 'ch'. func Generate(ch chan<- int) { for i := 2; ; i++ { ch <- i // Send 'i' to channel 'ch'. } } // Copy the values from channel 'in' to channel 'out', // removing those divisible by 'prime'. func Filter(in <-chan int, out cha...
Go
// This program solves the (English) peg // solitaire board game. // http://en.wikipedia.org/wiki/Peg_solitaire package main import "fmt" const N = 11 + 1 // length of a row (+1 for \n) // The board must be surrounded by 2 illegal // fields in each direction so that move() // doesn't need to check the board boundar...
Go
// Peano integers are represented by a linked // list whose nodes contain no data // (the nodes are the data). // http://en.wikipedia.org/wiki/Peano_axioms // This program demonstrates the power of Go's // segmented stacks when doing massively // recursive computations. package main import "fmt" // Number is a poin...
Go
// Concurrent computation of pi. // See http://goo.gl/ZuTZM. // // This demonstrates Go's ability to handle // large numbers of concurrent processes. // It is an unreasonable way to calculate pi. package main import ( "fmt" "math" ) func main() { fmt.Println(pi(5000)) } // pi launches n goroutines to compute an /...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "bufio" "fmt" "os" "strconv" "strings" ) // Generic expression parser/evaluator type Value interface { String() string BinaryOp...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This code differs from the slides in that it handles errors. package main import ( "crypto/aes" "crypto/cipher" "compress/gzip" "io" "log" "os" ) f...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This code differs from the slides in that it handles errors. package main import ( "crypto/aes" "crypto/cipher" "compress/gzip" "io" "log" "os" ) f...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "container/heap" "flag" "fmt" "math/rand" "time" ) const nRequester = 100 const nWorker = 10 var roundRobin = flag.Bool("r", fals...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "bufio" "fmt" "os" "strconv" "strings" ) // Generic expression parser/evaluator type Value interface { String() string BinaryOp...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "bytes" "flag" "io/ioutil" "log" "net/http" "os" "os/exec" "path/filepath" "regexp" "runtime" "strconv" "text/template" ) v...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Goplay is a web interface for experimenting with Go code. // It is similar to the Go Playground: http://golang.org/doc/play/ // // To use goplay: // $ cd...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains test cases for cgo. package cgotest /* int base_symbol = 0; #define alias_one base_symbol #define alias_two base_symbol */ import "C" ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgotest /* #include <stdlib.h> */ import "C" import ( "os" "runtime" "testing" "unsafe" ) // This is really an os package test but here for conven...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package backdoor func LockedOSThread() bool // in runtime.c
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgotest /* void callback(void *f); void callGoFoo(void); */ import "C" import ( "./backdoor" "runtime" "testing" "unsafe" ) // nestedCall calls i...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgotest /* #include <windows.h> unsigned int sleep(unsigned int seconds) { Sleep(1000 * seconds); return 0; } */ import "C"
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Basic test cases for cgo. package cgotest /* #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <errno.h> #define SHIFT(x, y) ((x)<<(...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgotest import "C" //export ReturnIntLong func ReturnIntLong() (int, C.long) { return 1, 2 }
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file contains test cases for cgo. package cgotest /* // issue 1222 typedef union { long align; } xxpthread_mutex_t; struct ibv_async_event { union...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgotest /* #include <stdio.h> typedef unsigned char Uint8; typedef unsigned short Uint16; typedef enum { MOD1 = 0x0000, MODX = 0x8000 } SDLMod; ty...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgotest /* #include <unistd.h> unsigned int sleep(unsigned int seconds); extern void BackgroundSleep(int); void twoSleep(int); */ import "C" import...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgotest // const char *greeting = "hello, world"; import "C" import ( "reflect" "testing" "unsafe" ) const greeting = "hello, world" type testPa...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgotest import "C" //export exportbyte func exportbyte() byte { return 0 } //export exportbool func exportbool() bool { return false } //export e...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgotest import "testing" // extern void BackIntoGo(void); // void IntoC(void); import "C" //export BackIntoGo func BackIntoGo() { x := 1 for i :=...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore package main import "." func main() { cgosotest.Test() }
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cgosotest /* #cgo LDFLAGS: -L. -lcgosotest void sofunc(void); */ import "C" func Test() { C.sofunc() } //export goCallback func goCallback() { }
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package life // #include "life.h" import "C" import "unsafe" func Run(gen, x, y int, a []int) { n := make([]int, x*y) for i := 0; i < gen; i++ { C.Step(...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore // Run the game of life in C using Go for parallelization. package main import ( "." "flag" "fmt" ) const MAXDIM = 100 var dim = flag....
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore // Compute Fibonacci numbers with two goroutines // that pass integers back and forth. No actual // concurrency, just threads and synchroniz...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* An example of wrapping a C library in Go. This is the GNU multiprecision library gmp's integer type mpz_t wrapped to look like the Go package big's integer ...
Go
// +build ignore /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributio...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore package main import "../stdio" func main() { stdio.Stdout.WriteString(stdio.Greeting + "\n") }
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore // Compute Fibonacci numbers with two goroutines // that pass integers back and forth. No actual // concurrency, just threads and synchroniz...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build ignore // Pass numbers along a chain of threads. package main import ( "../stdio" "runtime" "strconv" ) const N = 10 const R = 5 func link(le...
Go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* A trivial example of wrapping a C library in Go. For a more complex example and explanation, see ../gmp/gmp.go. */ package stdio /* #include <stdio.h> #in...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "bytes" "encoding/json" "errors" "fmt" "io" "log" "net/http" "net/url" "time" ) type obj map[string]interface{} // dash runs t...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "bytes" "encoding/xml" "flag" "fmt" "io/ioutil" "log" "os" "path/filepath" "regexp" "runtime" "strconv" "strings" "time" ) ...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* Go Builder is a continuous build client for the Go project. It integrates with the Go Dashboard AppEngine application. Go Builder is intended to run conti...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "bytes" "io" "log" "os" "os/exec" ) // run is a simple wrapper for exec.Run/Close func run(envv []string, dir string, argv ...strin...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package dashboard // This file handles the front page. import ( "bytes" "html/template" "io" "net/http" "sync" "time" "appengine" "appengine/datastor...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package dashboard // This file handles garbage collection of old CLs. import ( "net/http" "time" "appengine" "appengine/datastore" ) func init() { http...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package dashboard // This file handles receiving mail. import ( "net/http" "net/mail" "regexp" "time" "appengine" "appengine/datastore" ) func init() ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package dashboard // This file handles operations on the CL entity kind. import ( "encoding/json" "fmt" "html/template" "io" "net/http" netmail "net/mai...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package dashboard // This file handles identities of people. import ( "sort" ) var ( emailToPerson = make(map[string]string) // email => person preferred...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" "swig/callback" ) type GoCallback struct{} func (p *GoCallback) Run() string { return "GoCallback.Run" } func main() { c :=...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "swig/file" func main() { file.Puts("Hello, world") }
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0. A key derivation function is useful when encrypting data...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package twofish implements Bruce Schneier's Twofish encryption algorithm. package twofish // Twofish is defined in http://www.schneier.com/paper-twofish-pap...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package ripemd160 implements the RIPEMD-160 hash algorithm. package ripemd160 // RIPEMD-160 is designed by by Hans Dobbertin, Antoon Bosselaers, and Bart //...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // RIPEMD-160 block step. // In its own file so that a faster assembly or C version // can be substituted easily. package ripemd160 // work buffer indices and...
Go