code
stringlengths
10
1.34M
language
stringclasses
1 value
// +build OMIT package main import ( "fmt" "time" ) type MyError struct { When time.Time What string } func (e *MyError) Error() string { return fmt.Sprintf("at %v, %s", e.When, e.What) } func run() error { return &MyError{ time.Now(), "it didn't work", } } func main() { if err := run(); err != nil ...
Go
// +build OMIT package main import ( "fmt" ) func Sqrt(x float64) (float64, error) { return 0, nil } func main() { fmt.Println(Sqrt(2)) fmt.Println(Sqrt(-2)) }
Go
// +build OMIT package main import ( "fmt" "os" ) type Reader interface { Read(b []byte) (n int, err error) } type Writer interface { Write(b []byte) (n int, err error) } type ReadWriter interface { Reader Writer } func main() { var w Writer // os.Stdout implements Writer w = os.Stdout fmt.Fprintf(w, ...
Go
// +build OMIT package main import ( "fmt" "math" ) type MyFloat float64 func (f MyFloat) Abs() float64 { if f < 0 { return float64(-f) } return float64(f) } func main() { f := MyFloat(-math.Sqrt2) fmt.Println(f.Abs()) }
Go
package main import "code.google.com/p/go-tour/reader" type MyReader struct{} // TODO: Add a Read([]byte) (int, error) method to MyReader. func main() { reader.Validate(MyReader{}) }
Go
package main import ( "fmt" "io" "strings" ) func main() { r := strings.NewReader("Hello, Reader!") b := make([]byte, 8) for { n, err := r.Read(b) fmt.Printf("n = %v err = %v b = %v\n", n, err, b) fmt.Printf("b[:n] = %q\n", b[:n]) if err == io.EOF { break } } }
Go
// +build OMIT package main import ( "log" "net/http" ) func main() { // your http.Handle calls here log.Fatal(http.ListenAndServe("localhost:4000", nil)) }
Go
// +build OMIT package main import ( "fmt" "image" ) func main() { m := image.NewRGBA(image.Rect(0, 0, 100, 100)) fmt.Println(m.Bounds()) fmt.Println(m.At(0, 0).RGBA()) }
Go
// +build OMIT package main import ( "fmt" "math" ) type Vertex struct { X, Y float64 } func (v *Vertex) Abs() float64 { return math.Sqrt(v.X*v.X + v.Y*v.Y) } func main() { v := &Vertex{3, 4} fmt.Println(v.Abs()) }
Go
package main import "fmt" type IPAddr [4]byte // TODO: Add a "String() string" method to IPAddr. func main() { addrs := map[string]IPAddr{ "loopback": {127, 0, 0, 1}, "googleDNS": {8, 8, 8, 8}, } for n, a := range addrs { fmt.Printf("%v: %v\n", n, a) } }
Go
// +build OMIT package main import ( "fmt" "math" ) type Abser interface { Abs() float64 } func main() { var a Abser f := MyFloat(-math.Sqrt2) v := Vertex{3, 4} a = f // a MyFloat implements Abser a = &v // a *Vertex implements Abser // In the following line, v is a Vertex (not *Vertex) // and does NOT...
Go
package main import "fmt" type Person struct { Name string Age int } func (p Person) String() string { return fmt.Sprintf("%v (%v years)", p.Name, p.Age) } func main() { a := Person{"Arthur Dent", 42} z := Person{"Zaphod Beeblebrox", 9001} fmt.Println(a, z) }
Go
// +build OMIT package main import ( "fmt" "log" "net/http" ) type Hello struct{} func (h Hello) ServeHTTP( w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, "Hello!") } func main() { var h Hello err := http.ListenAndServe("localhost:4000", h) if err != nil { log.Fatal(err) } }
Go
// +build OMIT package main import ( "code.google.com/p/go-tour/pic" "image" ) type Image struct{} func main() { m := Image{} pic.ShowImage(m) }
Go
package reader import ( "fmt" "io" "os" ) func Validate(r io.Reader) { b := make([]byte, 1024) i, o := 0, 0 for ; i < 1<<20 && o < 1<<20; i++ { // test 1mb n, err := r.Read(b) for i, v := range b[:n] { if v != 'A' { fmt.Fprintf(os.Stderr, "got byte %x at offset %v, want 'A'\n", v, o+i) return ...
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 wc import "fmt" // Test runs a test suite against f. func Test(f func(string) map[string]int) { ok := true for _, c := range testCases { got := f...
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 tree import ( "fmt" "math/rand" ) // A Tree is a binary tree with integer values. type Tree struct { Left *Tree Value int Right *Tree } // New...
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 pic import ( "bytes" "encoding/base64" "fmt" "image" "image/png" ) func Show(f func(int, int) [][]uint8) { const ( dx = 256 dy = 256 ) da...
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 ( "bytes" "encoding/json" "go/ast" "go/parser" "go/printer" "go/token" "net/http" ) func init() { http.HandleFunc("/fmt", fmtHand...
Go
// Copyright 2013 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" "fmt" "html/template" "io" "io/ioutil" "net/http" "os" "path/filepath" "strings" "time" "golang.org...
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 !appengine package main import ( "flag" "fmt" "go/build" "io" "log" "net" "net/http" "net/url" "os" "os/exec" "path/filepath" "runtime"...
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 appengine package main import ( "bufio" "bytes" "io" "net/http" "strings" "appengine" _ "golang.org/x/tools/playground" ) const runUrl = ...
Go
// Copyright 2013 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 blog implements a web server for articles written in present format. package blog import ( "bytes" "encoding/json" "encoding/xml" "fmt" "html/...
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. // Adapted from encoding/xml/read_test.go. // Package atom defines XML data structures for an Atom feed. package atom import ( "encoding/xml" "time" ) typ...
Go
// +build ignore // mkstdlib generates the zstdlib.go file, containing the Go standard // library API symbols. It's baked into the binary to avoid scanning // GOPATH in the common case. package main import ( "bufio" "bytes" "fmt" "go/format" "io" "log" "os" "path" "path/filepath" "regexp" "sort" "strings"...
Go
// +build go1.2 // Copyright 2013 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. // Hacked up copy of go/ast/import.go package imports import ( "go/ast" "go/token" "sort" "strconv" ) // sortImports sorts runs of conse...
Go
// Copyright 2013 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 imports import ( "fmt" "go/ast" "go/build" "go/parser" "go/token" "os" "path" "path/filepath" "strings" "sync" "golang.org/x/tools/astutil"...
Go
// Copyright 2013 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 imports implements a Go pretty-printer (like package "go/format") // that also adds or removes import statements as necessary. package imports impor...
Go
// +build ignore // Copyright 2013 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. // Command mkindex creates the file "pkgindex.go" containing an index of the Go // standard library. The file is intended to be built as part ...
Go
// +build !go1.2 // Copyright 2013 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 imports import "go/ast" // Go 1.1 users don't get fancy package grouping. // But this is still gofmt-compliant: var sortImports = a...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/ast" "go/token" "reflect" "sort" "strings" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" ) // Im...
Go
// Copyright 2014 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 oracle contains the implementation of the oracle tool whose // command-line is provided by golang.org/x/tools/cmd/oracle. // // http://golang.org/s/o...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/ast" "go/token" "sort" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/ssa/ssautil" "golang.org/x/tools/go/types" ...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/ast" "go/token" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" ) // definition reports the location ...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/token" "golang.org/x/tools/go/callgraph" "golang.org/x/tools/go/ssa" "golang.org/x/tools/oracle/serial" ) // Callers r...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/ast" "go/token" "sort" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" )...
Go
// Copyright 2013 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 serial defines the oracle's schema for structured data // serialization using JSON, XML, etc. package serial // All 'pos' strings are of the form "f...
Go
// Copyright 2013 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 oracle import ( "bytes" "go/ast" "go/printer" "go/token" "sort" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" ) // freevars...
Go
package oracle // This file defines utilities for working with file positions. import ( "fmt" "go/parser" "go/token" "os" "path/filepath" "strconv" "strings" "golang.org/x/tools/astutil" ) // parseOctothorpDecimal returns the numeric value if s matches "#%d", // otherwise -1. func parseOctothorpDecimal(s st...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/ast" "go/token" "sort" "golang.org/x/tools/astutil" "golang.org/x/tools/go/loader" "golang.org/x/tools/go/pointer" "...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/token" "golang.org/x/tools/go/callgraph" "golang.org/x/tools/go/ssa" "golang.org/x/tools/oracle/serial" ) // Callstack...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/ast" "go/token" "sort" "golang.org/x/tools/go/types" "golang.org/x/tools/oracle/serial" ) // Referrers reports all id...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/token" "sort" "golang.org/x/tools/go/callgraph" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/types" "golang.org...
Go
// Copyright 2013 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 oracle import ( "fmt" "go/ast" "go/build" "go/token" "os" "path/filepath" "sort" "strings" "golang.org/x/tools/astutil" "golang.org/x/tools/...
Go
// Copyright 2013 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 oracle import ( "bytes" "fmt" "go/ast" "go/token" "log" "os" "strings" "golang.org/x/tools/astutil" "golang.org/x/tools/go/exact" "golang.or...
Go
// Copyright 2014 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 oracle import ( "fmt" "go/ast" "go/token" "sort" "golang.org/x/tools/astutil" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/ssa/ssautil" ...
Go
// Copyright 2013 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 intsets var a [1 << 8]byte func init() { for i := range a { var n byte for x := i; x != 0; x >>= 1 { if x&1 != 0 { n++ } } a[i] = n...
Go
// Copyright 2014 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 intsets provides Sparse, a compact and fast representation // for sparse sets of int values. // // The time complexity of the operations Len, Insert,...
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. // Vet is a simple checker for static errors in Go source code. // See doc.go for more information. package main import ( "bytes" "flag" "fmt" "go/ast" "g...
Go
// Copyright 2013 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" "fmt" "os" "strings" "unicode" ) var ( nl = []byte("\n") slashSlash = []byte("//") plusBuild = []byte("+build"...
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 test for unkeyed struct literals. package main import ( "flag" "go/ast" "strings" "golang.org/x/tools/cmd/vet/whitelist" ) var...
Go
// Copyright 2013 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. // Check for syntactically unreachable code. package main import ( "go/ast" "go/token" ) func init() { register("unreachable", "check for unreachable c...
Go
// Copyright 2013 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 to check for useless assignments. */ package main import ( "go/ast" "go/token" "reflect" ) func init() { register("assign"...
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 the printf-checker. package main import ( "bytes" "flag" "go/ast" "go/token" "strconv" "strings" "unicode/utf8" "golang.org/x/t...
Go
// Copyright 2014 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. // Check for invalid uintptr -> unsafe.Pointer conversions. package main import ( "go/ast" "go/token" "golang.org/x/tools/go/types" ) func init() { reg...
Go
// Copyright 2013 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 ( "go/ast" "go/token" ) func init() { register("atomic", "check for common mistaken usages of the sync/atomic package", checkAtomic...
Go
// Copyright 2014 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 boolean condition tests. package main import ( "go/ast" "go/token" ) func init() { register("bool", "check for mistakes involving ...
Go
// Copyright 2013 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 to check for useless function comparisons. A useless comparison is one like f == nil as opposed to f() == nil. */ package main ...
Go
// Copyright 2013 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 whitelist defines exceptions for the vet tool. package whitelist // UnkeyedLiteral are types that are actually slices, but // syntactically, we cann...
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 the code to check canonical methods. package main import ( "fmt" "go/ast" "go/printer" "strings" ) func init() { register("methods...
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 to check range loop variables bound inside function literals that are deferred or launched in new goroutines. We only check insta...
Go
// Copyright 2013 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. // Identify mismatches between assembly files and Go func declarations. package main import ( "bytes" "fmt" "go/ast" "go/token" "regexp" "strconv" "st...
Go
// Copyright 2013 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 to check for shadowed variables. A shadowed variable is a variable declared in an inner scope with the same name and type as a va...
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 the test for canonical struct tags. package main import ( "go/ast" "reflect" "strconv" ) func init() { register("structtags", "ch...
Go
// Copyright 2013 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 to check that locks are not passed by value. package main import ( "bytes" "fmt" "go/ast" "go/token" "golang.org/x/tools/...
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 the pieces of the tool that use typechecking from the go/types package. package main import ( "go/ast" "go/token" "golang.org/x/tool...
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. /* Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string. Vet uses heuristics...
Go
// Copyright 2014 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 to check for suspicious shifts. */ package main import ( "go/ast" "go/token" "golang.org/x/tools/go/exact" "golang.org/x/t...
Go
// Copyright 2014 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. // Stringer is a tool to automate the creation of methods that satisfy the fmt.Stringer // interface. Given the name of a (signed or unsigned) integer type T th...
Go
// Copyright 2014 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. // callgraph: a tool for reporting the call graph of a Go program. // See Usage for details, or run with -help. package main // TODO(adonovan): // // Features:...
Go
// Copyright 2014 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" "os" "sort" "strconv" "text/tabwriter" ) var ( changedOnly = flag.Bool("changed", false, "show only benchmarks that ...
Go
// Copyright 2014 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" ) // BenchCmp is a pair of benchmarks. type BenchCmp struct { Before *Bench After *Bench } // Correlate correlates be...
Go
// Copyright 2014 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" "bytes" "fmt" "io" "strconv" "strings" ) // Flags used by Bench.Measured to indicate // which measurements a Bench contain...
Go
// Copyright 2014 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. /* The benchcmp command displays performance changes between benchmarks. Benchcmp parses the output of two 'go test' benchmark runs, correlates the results pe...
Go
// The eg command performs example-based refactoring. // For documentation, run the command, or see Help in // code.google.com/p/go.tools/refactor/eg. package main import ( "flag" "fmt" "go/parser" "go/printer" "go/token" "os" "os/exec" "strings" "golang.org/x/tools/go/loader" "golang.org/x/tools/refactor/e...
Go
// The digraph command performs queries over unlabelled directed graphs // represented in text form. It is intended to integrate nicely with // typical UNIX command pipelines. // // Since directed graphs (import graphs, reference graphs, call graphs, // etc) often arise during software tool development and debugging, ...
Go
// Copyright 2013 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 program takes an HTML file and outputs a corresponding article file in // present format. See: golang.org/x/tools/present package main import ( "bufi...
Go
// Copyright 2013 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. // ssadump: a tool for displaying and interpreting the SSA form of Go programs. package main import ( "flag" "fmt" "go/build" "os" "runtime" "runtime/ppr...
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. /* The gotype command does syntactic and semantic analysis of Go files and packages like the front-end of a Go compiler. Errors are reported if the analysis fai...
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" "go/ast" "go/build" "go/parser" "go/scanner" "go/token" "io/ioutil" "os" "path/filepath" "runtime" "time" "gol...
Go
// Copyright 2014 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" "fmt" "go/token" "io" "math/big" "golang.org/x/tools/go/exact" "golang.org/x/tools/go/types" ) // TODO(gri) use tabwrite...
Go
// Copyright 2014 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" "flag" "fmt" "go/build" "io/ioutil" "os" "path/filepath" "strings" "golang.org/x/tools/go/types" ) var ( source = f...
Go
// Copyright 2014 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 implements writing of types. The functionality is lifted // directly from go/types, but now contains various modifications for // nicer output. // ...
Go
// Copyright 2014 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 implements access to export data from source. package main import ( "golang.org/x/tools/go/types" ) func init() { register("source", sourceImp...
Go
// Copyright 2014 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 implements access to gc-generated export data. package main import ( "golang.org/x/tools/go/gcimporter" ) func init() { register("gc", gcimpor...
Go
// Copyright 2014 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 implements access to gccgo-generated export data. package main import ( "golang.org/x/tools/go/gccgoimporter" "golang.org/x/tools/go/types" ) ...
Go
// Copyright 2014 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. // The godex command prints (dumps) exported information of packages // or selected package objects. // // In contrast to godoc, godex extracts this information...
Go
// Copyright 2013 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. // oracle: a tool for answering questions about Go source code. // http://golang.org/s/oracle-design // http://golang.org/s/oracle-user-manual // // Run with -h...
Go
// Copyright 2013 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" "bytes" "fmt" "html/template" "io" "io/ioutil" "math" "os" "os/exec" "path/filepath" "runtime" "golang.org/x/tools/c...
Go
// Copyright 2013 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 implements the visitor that computes the (line, column)-(line-column) range for each function. package main import ( "bufio" "fmt" "go/ast" "...
Go
// Copyright 2013 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" "fmt" "go/ast" "go/parser" "go/printer" "go/token" "io" "io/ioutil" "log" "os" "path/filepath" "sort" "strco...
Go
// The gorename command performs precise type-safe renaming of // identifiers in Go source code. See the -help message or Usage // constant for details. package main import ( "flag" "fmt" "go/build" "os" "runtime" "golang.org/x/tools/refactor/rename" ) var ( offsetFlag = flag.String("offset", "", "file and b...
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. // godoc: Go Documentation Server // Web server tree: // // http://godoc/ main landing page // http://godoc/doc/ serve from $GOROOT/doc - spec, mem, etc. // h...
Go
// Copyright 2014 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 "net/http" // Register a redirect handler for /dl/ to the golang.org download page. // This file will not be included when deploying godoc...
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 appengine package main // This file replaces main.go when running godoc under app-engine. // See README.godoc-app for details. import ( "archive/z...
Go
// Copyright 2013 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 handlers that serve go-import redirects for Go // sub-repositories. It specifies the mapping from import paths like // "golang.org/x/t...
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. // The /doc/codewalk/ tree is synthesized from codewalk descriptions, // files named $GOROOT/doc/codewalk/*.xml. // For an example and a description of the form...
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. // The /doc/codewalk/ tree is synthesized from codewalk descriptions, // files named $GOROOT/doc/codewalk/*.xml. // For an example and a description of the form...
Go
// Copyright 2013 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" "go/build" "log" "net/http" "os" "path/filepath" "runtime" "strings" "sync" "golang.org/x/tools/blog" "golang.org/x/too...
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" "go/format" "net/http" // This package registers "/compile" and "/share" handlers // that redirect to the go...
Go