diff --git a/cmd/auth/go.mod b/cmd/auth/go.mod
index ea912ce7743..2a769fe9ac0 100644
--- a/cmd/auth/go.mod
+++ b/cmd/auth/go.mod
@@ -1,3 +1,3 @@
module golang.org/x/tools/cmd/auth
-go 1.23.0
+go 1.24.0
diff --git a/cmd/bundle/main.go b/cmd/bundle/main.go
index fa73eb83a0a..d6b59095aa8 100644
--- a/cmd/bundle/main.go
+++ b/cmd/bundle/main.go
@@ -241,7 +241,7 @@ func bundle(src, dst, dstpkg, prefix, buildTags string) ([]byte, error) {
// Concatenate package comments from all files...
for _, f := range pkg.Syntax {
if doc := f.Doc.Text(); strings.TrimSpace(doc) != "" {
- for _, line := range strings.Split(doc, "\n") {
+ for line := range strings.SplitSeq(doc, "\n") {
fmt.Fprintf(&out, "// %s\n", line)
}
}
diff --git a/cmd/compilebench/main.go b/cmd/compilebench/main.go
index a1805fda391..74ab2867093 100644
--- a/cmd/compilebench/main.go
+++ b/cmd/compilebench/main.go
@@ -511,7 +511,7 @@ func runBuildCmd(name string, count int, dir, tool string, args []string) error
if err != nil {
log.Print("cannot find memory profile after compilation")
}
- for _, line := range strings.Split(string(out), "\n") {
+ for line := range strings.SplitSeq(string(out), "\n") {
f := strings.Fields(line)
if len(f) < 4 || f[0] != "#" || f[2] != "=" {
continue
diff --git a/cmd/digraph/digraph.go b/cmd/digraph/digraph.go
index 9a8abca59fd..f3811fe80d4 100644
--- a/cmd/digraph/digraph.go
+++ b/cmd/digraph/digraph.go
@@ -67,6 +67,8 @@ func (l nodelist) println(sep string) {
type nodeset map[string]bool
+func singleton(x string) nodeset { return nodeset{x: true} }
+
func (s nodeset) sort() nodelist {
nodes := make(nodelist, len(s))
var i int
@@ -191,26 +193,17 @@ func (g graph) sccs() []nodeset {
}
func (g graph) allpaths(from, to string) error {
- // Mark all nodes to "to".
- seen := make(nodeset) // value of seen[x] indicates whether x is on some path to "to"
- var visit func(node string) bool
- visit = func(node string) bool {
- reachesTo, ok := seen[node]
- if !ok {
- reachesTo = node == to
- seen[node] = reachesTo
- for e := range g[node] {
- if visit(e) {
- reachesTo = true
- }
- }
- if reachesTo && node != to {
- seen[node] = true
- }
+ // We intersect the forward closure of 'from' with
+ // the reverse closure of 'to'. This is not the most
+ // efficient implementation, but it's the clearest,
+ // and the previous one had bugs.
+ seen := g.reachableFrom(singleton(from))
+ rev := g.transpose().reachableFrom(singleton(to))
+ for n := range seen {
+ if !rev[n] {
+ delete(seen, n)
}
- return reachesTo
}
- visit(from)
// For each marked node, collect its marked successors.
var edges []string
@@ -241,7 +234,7 @@ func (g graph) somepath(from, to string) error {
tail *path
}
- seen := nodeset{from: true}
+ seen := singleton(from)
var queue []*path
queue = append(queue, &path{node: from, tail: nil})
@@ -469,14 +462,14 @@ func digraph(cmd string, args []string) error {
}
edges := make(map[string]struct{})
- for from := range g.reachableFrom(nodeset{node: true}) {
+ for from := range g.reachableFrom(singleton(node)) {
for to := range g[from] {
edges[fmt.Sprintf("%s %s", from, to)] = struct{}{}
}
}
gtrans := g.transpose()
- for from := range gtrans.reachableFrom(nodeset{node: true}) {
+ for from := range gtrans.reachableFrom(singleton(node)) {
for to := range gtrans[from] {
edges[fmt.Sprintf("%s %s", to, from)] = struct{}{}
}
diff --git a/cmd/digraph/digraph_test.go b/cmd/digraph/digraph_test.go
index c9527588f27..d244615117b 100644
--- a/cmd/digraph/digraph_test.go
+++ b/cmd/digraph/digraph_test.go
@@ -156,6 +156,33 @@ func TestAllpaths(t *testing.T) {
to: "H",
want: "A B\nA C\nB D\nC D\nD E\nE F\nE G\nF H\nG H\n",
},
+ {
+ // C <--> B --> A --> D <--> E
+ // ⋃
+ name: "non-regression test for #74842",
+ in: "A D\nB A\nB B\nB C\nC B\nD E\nE D",
+ to: "D",
+ want: "A D\nD E\nE D\n",
+ },
+ {
+ // A --> B --> D
+ // ^
+ // v
+ // C[123]
+ name: "regression test for #74842",
+ in: "A B\nB C1\nB C2\nB C3\nB D\nC1 B\nC2 B\nC3 B\n",
+ to: "D",
+ want: "A B\nB C1\nB C2\nB C3\nB D\nC1 B\nC2 B\nC3 B\n",
+ },
+ {
+ // A -------> B --> D
+ // \--> C ---^ |
+ // ^----------+
+ name: "another regression test for #74842",
+ in: "A B\nA C\nB D\nC B\nD C\n",
+ to: "D",
+ want: "A B\nA C\nB D\nC B\nD C\n",
+ },
} {
t.Run(test.name, func(t *testing.T) {
stdin = strings.NewReader(test.in)
@@ -225,7 +252,7 @@ func TestSomepath(t *testing.T) {
got = strings.Join(lines[1:], "\n")
var oneMatch bool
- for _, want := range strings.Split(test.wantAnyOf, "|") {
+ for want := range strings.SplitSeq(test.wantAnyOf, "|") {
if got == want {
oneMatch = true
}
diff --git a/cmd/digraph/doc.go b/cmd/digraph/doc.go
index 55e3dd4ff97..fc9ce1d6309 100644
--- a/cmd/digraph/doc.go
+++ b/cmd/digraph/doc.go
@@ -28,9 +28,9 @@ The supported commands are:
reverse
- When invoked with the
-
- If any source file contains a compilation error, the source view
- will highlight the errant location in red. Hovering over it
- displays the error message.
-
- In the source view, every referring identifier is annotated with
- information about the language entity it refers to: a package,
- constant, variable, type, function or statement label.
-
- Hovering over the identifier reveals the entity's kind and type
- (e.g.
- Clicking the link takes you to the entity's definition.
-
- Clicking on the identifier that defines a named type causes a panel
- to appear, displaying information about the named type, including
- its size and alignment in bytes, its
- method set, and its
- implements relation: the set of types T that are assignable to
- or from this type U where at least one of T or U is an interface.
-
- This example shows information about
- The method set includes not only the declared methods of the type,
- but also any methods "promoted" from anonymous fields of structs,
- such as
- The method set and implements relation are also available
- via the package view.
-
-
- Compared to type analysis, pointer analysis requires more time and
- memory, and is impractical for code bases exceeding a million lines.
-
- When pointer analysis is complete, the source view annotates the
- code with callers and callees information: callers
- information is associated with the
- In this example, hovering over the declaration of the
-
- Clicking the link navigates to the sole caller. (If there were
- multiple callers, a list of choices would be displayed first.)
-
- Notice that hovering over this call reveals that there are 19
- possible callees at this site, of which our
- Pointer analysis gives a very precise approximation of the call
- graph compared to type-based techniques.
-
- As a case in point, the next example shows the dynamic call inside
- the
- Recall that all such functions have type
- The same call graph information is presented in a very different way
- in the package view. For each package, an interactive tree view
- allows exploration of the call graph as it relates to just that
- package; all functions from other packages are elided.
-
- The roots of the tree are the external entry points of the package:
- not only its exported functions, but also any unexported or
- anonymous functions that are called (dynamically) from outside the
- package.
-
- This example shows the entry points of the
-
- Notice that the nodes for Glob and Join appear multiple times: the
- tree is a partial unrolling of a cyclic graph; the full unrolling
- is in general infinite.
-
- For each function documented in the package view, another
- interactive tree view allows exploration of the same graph starting
- at that function.
-
- This is a portion of the internal graph of
-
- Because concurrent Go programs use channels to pass not just values
- but also control between different goroutines, it is natural when
- reading Go code to want to navigate from a channel send to the
- corresponding receive so as to understand the sequence of events.
-
- Godoc annotates every channel operation—make, send, range,
- receive, close—with a link to a panel displaying information
- about other operations that might alias the same channel.
-
- This example, from the tests of
- Clicking on the
- Notice also that the send occurs in a different (anonymous) function
- from the outer one containing the
- Here's another example of send on a different
- The analysis finds just one receive operation that might receive
- from this channel, in the test for this feature.
-
- All analysis results pertain to exactly
- one configuration (e.g. amd64 linux). Files that are conditionally
- compiled based on different platforms or build tags are not visible
- to the analysis.
-
- Files that
- Files are not periodically re-analyzed.
- If the files change underneath the running server, the displayed
- markup is misaligned.
-
- Additional issues are listed at
- tools/godoc/analysis/README.
-
- tag
- var buf2 bytes.Buffer
- buf2.WriteString("
")
- FormatText(&buf2, buf1.Bytes(), -1, true, id.Name, nil)
- buf2.WriteString("
")
- return &Snippet{fset.Position(id.Pos()).Line, buf2.String()}
-}
-
-func findSpec(list []ast.Spec, id *ast.Ident) ast.Spec {
- for _, spec := range list {
- switch s := spec.(type) {
- case *ast.ImportSpec:
- if s.Name == id {
- return s
- }
- case *ast.ValueSpec:
- if slices.Contains(s.Names, id) {
- return s
- }
- case *ast.TypeSpec:
- if s.Name == id {
- return s
- }
- }
- }
- return nil
-}
-
-func (p *Presentation) genSnippet(fset *token.FileSet, d *ast.GenDecl, id *ast.Ident) *Snippet {
- s := findSpec(d.Specs, id)
- if s == nil {
- return nil // declaration doesn't contain id - exit gracefully
- }
-
- // only use the spec containing the id for the snippet
- dd := &ast.GenDecl{
- Doc: d.Doc,
- TokPos: d.Pos(),
- Tok: d.Tok,
- Lparen: d.Lparen,
- Specs: []ast.Spec{s},
- Rparen: d.Rparen,
- }
-
- return p.newSnippet(fset, dd, id)
-}
-
-func (p *Presentation) funcSnippet(fset *token.FileSet, d *ast.FuncDecl, id *ast.Ident) *Snippet {
- if d.Name != id {
- return nil // declaration doesn't contain id - exit gracefully
- }
-
- // only use the function signature for the snippet
- dd := &ast.FuncDecl{
- Doc: d.Doc,
- Recv: d.Recv,
- Name: d.Name,
- Type: d.Type,
- }
-
- return p.newSnippet(fset, dd, id)
-}
-
-// NewSnippet creates a text snippet from a declaration decl containing an
-// identifier id. Parts of the declaration not containing the identifier
-// may be removed for a more compact snippet.
-func NewSnippet(fset *token.FileSet, decl ast.Decl, id *ast.Ident) *Snippet {
- // TODO(bradfitz, adg): remove this function. But it's used by indexer, which
- // doesn't have a *Presentation, and NewSnippet needs a TabWidth.
- var p Presentation
- p.TabWidth = 4
- return p.NewSnippet(fset, decl, id)
-}
-
-// NewSnippet creates a text snippet from a declaration decl containing an
-// identifier id. Parts of the declaration not containing the identifier
-// may be removed for a more compact snippet.
-func (p *Presentation) NewSnippet(fset *token.FileSet, decl ast.Decl, id *ast.Ident) *Snippet {
- var s *Snippet
- switch d := decl.(type) {
- case *ast.GenDecl:
- s = p.genSnippet(fset, d, id)
- case *ast.FuncDecl:
- s = p.funcSnippet(fset, d, id)
- }
-
- // handle failure gracefully
- if s == nil {
- var buf bytes.Buffer
- fmt.Fprintf(&buf, `could not generate a snippet for %s`, id.Name)
- s = &Snippet{fset.Position(id.Pos()).Line, buf.String()}
- }
- return s
-}
diff --git a/godoc/spec.go b/godoc/spec.go
deleted file mode 100644
index c8142363e9b..00000000000
--- a/godoc/spec.go
+++ /dev/null
@@ -1,179 +0,0 @@
-// 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 godoc
-
-// This file contains the mechanism to "linkify" html source
-// text containing EBNF sections (as found in go_spec.html).
-// The result is the input source text with the EBNF sections
-// modified such that identifiers are linked to the respective
-// definitions.
-
-import (
- "bytes"
- "fmt"
- "io"
- "text/scanner"
-)
-
-type ebnfParser struct {
- out io.Writer // parser output
- src []byte // parser input
- scanner scanner.Scanner
- prev int // offset of previous token
- pos int // offset of current token
- tok rune // one token look-ahead
- lit string // token literal
-}
-
-func (p *ebnfParser) flush() {
- p.out.Write(p.src[p.prev:p.pos])
- p.prev = p.pos
-}
-
-func (p *ebnfParser) next() {
- p.tok = p.scanner.Scan()
- p.pos = p.scanner.Position.Offset
- p.lit = p.scanner.TokenText()
-}
-
-func (p *ebnfParser) printf(format string, args ...any) {
- p.flush()
- fmt.Fprintf(p.out, format, args...)
-}
-
-func (p *ebnfParser) errorExpected(msg string) {
- p.printf(`error: expected %s, found %s`, msg, scanner.TokenString(p.tok))
-}
-
-func (p *ebnfParser) expect(tok rune) {
- if p.tok != tok {
- p.errorExpected(scanner.TokenString(tok))
- }
- p.next() // make progress in any case
-}
-
-func (p *ebnfParser) parseIdentifier(def bool) {
- if p.tok == scanner.Ident {
- name := p.lit
- if def {
- p.printf(`%s`, name, name)
- } else {
- p.printf(`%s`, name, name)
- }
- p.prev += len(name) // skip identifier when printing next time
- p.next()
- } else {
- p.expect(scanner.Ident)
- }
-}
-
-func (p *ebnfParser) parseTerm() bool {
- switch p.tok {
- case scanner.Ident:
- p.parseIdentifier(false)
-
- case scanner.String, scanner.RawString:
- p.next()
- const ellipsis = '…' // U+2026, the horizontal ellipsis character
- if p.tok == ellipsis {
- p.next()
- p.expect(scanner.String)
- }
-
- case '(':
- p.next()
- p.parseExpression()
- p.expect(')')
-
- case '[':
- p.next()
- p.parseExpression()
- p.expect(']')
-
- case '{':
- p.next()
- p.parseExpression()
- p.expect('}')
-
- default:
- return false // no term found
- }
-
- return true
-}
-
-func (p *ebnfParser) parseSequence() {
- if !p.parseTerm() {
- p.errorExpected("term")
- }
- for p.parseTerm() {
- }
-}
-
-func (p *ebnfParser) parseExpression() {
- for {
- p.parseSequence()
- if p.tok != '|' {
- break
- }
- p.next()
- }
-}
-
-func (p *ebnfParser) parseProduction() {
- p.parseIdentifier(true)
- p.expect('=')
- if p.tok != '.' {
- p.parseExpression()
- }
- p.expect('.')
-}
-
-func (p *ebnfParser) parse(out io.Writer, src []byte) {
- // initialize ebnfParser
- p.out = out
- p.src = src
- p.scanner.Init(bytes.NewBuffer(src))
- p.next() // initializes pos, tok, lit
-
- // process source
- for p.tok != scanner.EOF {
- p.parseProduction()
- }
- p.flush()
-}
-
-// Markers around EBNF sections
-var (
- openTag = []byte(``)
- closeTag = []byte(`
`)
-)
-
-func Linkify(out io.Writer, src []byte) {
- for len(src) > 0 {
- // i: beginning of EBNF text (or end of source)
- i := bytes.Index(src, openTag)
- if i < 0 {
- i = len(src) - len(openTag)
- }
- i += len(openTag)
-
- // j: end of EBNF text (or end of source)
- j := bytes.Index(src[i:], closeTag) // close marker
- if j < 0 {
- j = len(src) - i
- }
- j += i
-
- // write text before EBNF
- out.Write(src[0:i])
- // process EBNF
- var p ebnfParser
- p.parse(out, src[i:j])
-
- // advance
- src = src[j:]
- }
-}
diff --git a/godoc/spec_test.go b/godoc/spec_test.go
deleted file mode 100644
index c016516877a..00000000000
--- a/godoc/spec_test.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2018 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 godoc
-
-import (
- "bytes"
- "strings"
- "testing"
-)
-
-func TestParseEBNFString(t *testing.T) {
- var p ebnfParser
- var buf bytes.Buffer
- src := []byte("octal_byte_value = `\\` octal_digit octal_digit octal_digit .")
- p.parse(&buf, src)
-
- if strings.Contains(buf.String(), "error") {
- t.Error(buf.String())
- }
-}
diff --git a/godoc/spot.go b/godoc/spot.go
deleted file mode 100644
index 4720e5b1f06..00000000000
--- a/godoc/spot.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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 godoc
-
-// ----------------------------------------------------------------------------
-// SpotInfo
-
-// A SpotInfo value describes a particular identifier spot in a given file;
-// It encodes three values: the SpotKind (declaration or use), a line or
-// snippet index "lori", and whether it's a line or index.
-//
-// The following encoding is used:
-//
-// bits 32 4 1 0
-// value [lori|kind|isIndex]
-type SpotInfo uint32
-
-// SpotKind describes whether an identifier is declared (and what kind of
-// declaration) or used.
-type SpotKind uint32
-
-const (
- PackageClause SpotKind = iota
- ImportDecl
- ConstDecl
- TypeDecl
- VarDecl
- FuncDecl
- MethodDecl
- Use
- nKinds
-)
-
-var (
- // These must match the SpotKind values above.
- name = []string{
- "Packages",
- "Imports",
- "Constants",
- "Types",
- "Variables",
- "Functions",
- "Methods",
- "Uses",
- "Unknown",
- }
-)
-
-func (x SpotKind) Name() string { return name[x] }
-
-func init() {
- // sanity check: if nKinds is too large, the SpotInfo
- // accessor functions may need to be updated
- if nKinds > 8 {
- panic("internal error: nKinds > 8")
- }
-}
-
-// makeSpotInfo makes a SpotInfo.
-func makeSpotInfo(kind SpotKind, lori int, isIndex bool) SpotInfo {
- // encode lori: bits [4..32)
- x := SpotInfo(lori) << 4
- if int(x>>4) != lori {
- // lori value doesn't fit - since snippet indices are
- // most certainly always smaller then 1<<28, this can
- // only happen for line numbers; give it no line number (= 0)
- x = 0
- }
- // encode kind: bits [1..4)
- x |= SpotInfo(kind) << 1
- // encode isIndex: bit 0
- if isIndex {
- x |= 1
- }
- return x
-}
-
-func (x SpotInfo) Kind() SpotKind { return SpotKind(x >> 1 & 7) }
-func (x SpotInfo) Lori() int { return int(x >> 4) }
-func (x SpotInfo) IsIndex() bool { return x&1 != 0 }
diff --git a/godoc/static/analysis/call-eg.png b/godoc/static/analysis/call-eg.png
deleted file mode 100644
index c48bf4d9207..00000000000
Binary files a/godoc/static/analysis/call-eg.png and /dev/null differ
diff --git a/godoc/static/analysis/call3.png b/godoc/static/analysis/call3.png
deleted file mode 100644
index 387a38c64fc..00000000000
Binary files a/godoc/static/analysis/call3.png and /dev/null differ
diff --git a/godoc/static/analysis/callers1.png b/godoc/static/analysis/callers1.png
deleted file mode 100644
index 80fbc62e950..00000000000
Binary files a/godoc/static/analysis/callers1.png and /dev/null differ
diff --git a/godoc/static/analysis/callers2.png b/godoc/static/analysis/callers2.png
deleted file mode 100644
index 59a84edbc99..00000000000
Binary files a/godoc/static/analysis/callers2.png and /dev/null differ
diff --git a/godoc/static/analysis/chan1.png b/godoc/static/analysis/chan1.png
deleted file mode 100644
index 5eb28111554..00000000000
Binary files a/godoc/static/analysis/chan1.png and /dev/null differ
diff --git a/godoc/static/analysis/chan2a.png b/godoc/static/analysis/chan2a.png
deleted file mode 100644
index b757504179e..00000000000
Binary files a/godoc/static/analysis/chan2a.png and /dev/null differ
diff --git a/godoc/static/analysis/chan2b.png b/godoc/static/analysis/chan2b.png
deleted file mode 100644
index d197862d1b6..00000000000
Binary files a/godoc/static/analysis/chan2b.png and /dev/null differ
diff --git a/godoc/static/analysis/error1.png b/godoc/static/analysis/error1.png
deleted file mode 100644
index 69550b9d060..00000000000
Binary files a/godoc/static/analysis/error1.png and /dev/null differ
diff --git a/godoc/static/analysis/help.html b/godoc/static/analysis/help.html
deleted file mode 100644
index dd1b606da71..00000000000
--- a/godoc/static/analysis/help.html
+++ /dev/null
@@ -1,254 +0,0 @@
-
-
-
-
-
-
--analysis
flag, godoc performs
- static analysis on the Go packages it indexes and displays the
- results in the source and package views. This document provides a
- brief tour of these features.
-Type analysis features
-godoc -analysis=type
performs static checking similar
- to that done by a compiler: it detects ill-formed programs, resolves
- each identifier to the entity it denotes, computes the type of each
- expression and the method set of each type, and determines which
- types are assignable to each interface type.
-
- Type analysis is relatively quick, requiring about 10 seconds for
- the >200 packages of the standard library, for example.
-Compiler errors
-
-
-Identifier resolution
-var x int
or func f
- func(int) string
).
-
-
-
-
-
-Type information: size/alignment, method set, interfaces
-net/rpc.methodType
.
-
-
sync.Mutex
in this example.
-
- In addition, the receiver type is displayed as *T
or
- T
depending on whether it requires the address or just
- a copy of the receiver value.
-
-
-
Pointer analysis features
-godoc -analysis=pointer
additionally performs a precise
- whole-program pointer analysis. In other words, it
- approximates the set of memory locations to which each
- reference—not just vars of kind *T
, but also
- []T
, func
, map
,
- chan
, and interface
—may refer. This
- information reveals the possible destinations of each dynamic call
- (via a func
variable or interface method), and the
- relationship between send and receive operations on the same
- channel.
-Call graph navigation
-func
keyword that
- declares a function, and callees information is associated with the
- open paren '(
' of
- a function call.
-rot13
function (defined in strings/strings_test.go)
- reveals that it is called in exactly one place.
-
-
-
rot13
- function was just one: this is a dynamic call through a variable of
- type func(rune) rune
.
-
- Clicking on the call brings up the list of all 19 potential callees,
- shown truncated. Many of them are anonymous functions.
-
-
testing
package responsible for calling all
- user-defined functions named ExampleXYZ
.
-
-
func()
,
- i.e. no arguments and no results. A type-based approximation could
- only conclude that this call might dispatch to any function matching
- that type—and these are very numerous in most
- programs—but pointer analysis can track the flow of specific
- func
values through the testing package.
-
- As an indication of its precision, the result contains only
- functions whose name starts with Example
.
-Intra-package call graph
-path/filepath
package, with the call graph for
- Glob
expanded several levels
-
-
net/http.ListenAndServe
.
-
-
-
Channel peers (send ↔ receive)
-net/http
, shows a send
- operation on a chan bool
.
-
-
<-
send operator reveals that this
- channel is made at a unique location (line 332) and that there are
- three receive operations that might read this value.
-
- It hardly needs pointing out that some channel element types are
- very widely used (e.g. struct{}, bool, int, interface{}) and that a
- typical Go program might contain dozens of receive operations on a
- value of type chan bool
; yet the pointer analysis is
- able to distinguish operations on channels at a much finer precision
- than based on their type alone.
-make
and the receive
- operations.
-chan
- bool
, also in package net/http
:
-
-
-
-
Known issues
-import "C"
require
- preprocessing by the cgo tool. The file offsets after preprocessing
- do not align with the unpreprocessed file, so markup is misaligned.
-
-
-
-
-File
-
- Bytes
-
- Modified
-
-
-{{range .}}
-..
-
- {{$name_html := fileInfoName . | html}}
-
-{{end}}
-
-{{$name_html}}
-
- {{html .Size}}
-
- {{fileInfoTime . | html}}
-
-{{html .}} -
diff --git a/godoc/static/example.html b/godoc/static/example.html deleted file mode 100644 index a7f66914654..00000000000 --- a/godoc/static/example.html +++ /dev/null @@ -1,28 +0,0 @@ -▹ Example{{example_suffix .Name}}
-' + - 'Your download should begin shortly. ' + - 'If it does not, click this link.
' - ); - message.find('a').attr('href', download); - message.insertAfter('#nav'); - - window.location = download; - } - - function updateVersionTags() { - var v = window.goVersion; - if (/^go[0-9.]+$/.test(v)) { - $('.versionTag') - .empty() - .text(v); - $('.whereTag').hide(); - } - } - - function addPermalinks() { - function addPermalink(source, parent) { - var id = source.attr('id'); - if (id == '' || id.indexOf('tmp_') === 0) { - // Auto-generated permalink. - return; - } - if (parent.find('> .permalink').length) { - // Already attached. - return; - } - parent - .append(' ') - .append($("¶").attr('href', '#' + id)); - } - - $('#page .container') - .find('h2[id], h3[id]') - .each(function() { - var el = $(this); - addPermalink(el, el); - }); - - $('#page .container') - .find('dl[id]') - .each(function() { - var el = $(this); - // Add the anchor to the "dt" element. - addPermalink(el, el.find('> dt').first()); - }); - } - - $('.js-expandAll').click(function() { - if ($(this).hasClass('collapsed')) { - toggleExamples('toggle'); - $(this).text('(Collapse All)'); - } else { - toggleExamples('toggleVisible'); - $(this).text('(Expand All)'); - } - $(this).toggleClass('collapsed'); - }); - - function toggleExamples(className) { - // We need to explicitly iterate through divs starting with "example_" - // to avoid toggling Overview and Index collapsibles. - $("[id^='example_']").each(function() { - // Check for state and click it only if required. - if ($(this).hasClass(className)) { - $(this) - .find('.toggleButton') - .first() - .click(); - } - }); - } - - $(document).ready(function() { - generateTOC(); - addPermalinks(); - bindToggles('.toggle'); - bindToggles('.toggleVisible'); - bindToggleLinks('.exampleLink', 'example_'); - bindToggleLinks('.overviewLink', ''); - bindToggleLinks('.examplesLink', ''); - bindToggleLinks('.indexLink', ''); - setupDropdownPlayground(); - setupInlinePlayground(); - fixFocus(); - setupTypeInfo(); - setupCallgraphs(); - toggleHash(); - personalizeInstallInstructions(); - updateVersionTags(); - - // godoc.html defines window.initFuncs in the tag, and root.html and - // codewalk.js push their on-page-ready functions to the list. - // We execute those functions here, to avoid loading jQuery until the page - // content is loaded. - for (var i = 0; i < window.initFuncs.length; i++) window.initFuncs[i](); - }); - - // -- analysis --------------------------------------------------------- - - // escapeHTML returns HTML for s, with metacharacters quoted. - // It is safe for use in both elements and attributes - // (unlike the "set innerText, read innerHTML" trick). - function escapeHTML(s) { - return s - .replace(/&/g, '&') - .replace(/\"/g, '"') - .replace(/\'/g, ''') - .replace(//g, '>'); - } - - // makeAnchor returns HTML for an element, given an anchorJSON object. - function makeAnchor(json) { - var html = escapeHTML(json.Text); - if (json.Href != '') { - html = "" + html + ''; - } - return html; - } - - function showLowFrame(html) { - var lowframe = document.getElementById('lowframe'); - lowframe.style.height = '200px'; - lowframe.innerHTML = - "" + - html + - '
\n' + - "' + escapeHTML(data.Callee) + '
:' + escapeHTML(caller.Func) + '
';
- var sites = caller.Sites;
- if (sites != null && sites.length > 0) {
- html += ' at line ';
- for (var j = 0; j < sites.length; j++) {
- if (j > 0) {
- html += ', ';
- }
- html += '' + makeAnchor(sites[j]) + '
';
- }
- }
- html += '' + makeAnchor(data.Callees[i]) + '
' +
- data.Name +
- '
: ' +
- ' (size=' +
- data.Size +
- ', align=' +
- data.Align +
- ')' + escapeHTML(group.Descr) + '
';
- for (var j = 0; j < group.Facts.length; j++) {
- var fact = group.Facts[j];
- var y = '' + makeAnchor(fact.Other) + '
';
- if (fact.ByKind != null) {
- html += escapeHTML(fact.ByKind) + ' type ' + y + ' implements ' + x;
- } else {
- html += x + ' implements ' + y;
- }
- html += '' + makeAnchor(info.Methods[i]) + '
' +
- escapeHTML(ops[i].Fn) +
- '
t |