diff options
-rw-r--r-- | cmd/starlark/starlark.go | 4 | ||||
-rw-r--r-- | docs/cmd/starlark/index.html | 9 | ||||
-rw-r--r-- | docs/index.html | 2 | ||||
-rw-r--r-- | docs/internal/chunkedfile/index.html | 9 | ||||
-rw-r--r-- | docs/internal/compile/index.html | 9 | ||||
-rw-r--r-- | docs/repl/index.html | 9 | ||||
-rw-r--r-- | docs/resolve/index.html | 9 | ||||
-rw-r--r-- | docs/starlark/index.html | 9 | ||||
-rw-r--r-- | docs/starlarkstruct/index.html | 9 | ||||
-rw-r--r-- | docs/starlarktest/index.html | 9 | ||||
-rw-r--r-- | docs/syntax/index.html | 9 | ||||
-rw-r--r-- | docs/update.go | 71 | ||||
-rw-r--r-- | internal/chunkedfile/chunkedfile.go | 2 | ||||
-rw-r--r-- | internal/compile/compile.go | 2 | ||||
-rw-r--r-- | repl/repl.go | 2 | ||||
-rw-r--r-- | resolve/resolve.go | 2 | ||||
-rw-r--r-- | starlarkstruct/struct.go | 4 | ||||
-rw-r--r-- | starlarktest/starlarktest.go | 2 | ||||
-rw-r--r-- | syntax/syntax.go | 2 |
19 files changed, 163 insertions, 11 deletions
diff --git a/cmd/starlark/starlark.go b/cmd/starlark/starlark.go index 8b7d18f..593d7bd 100644 --- a/cmd/starlark/starlark.go +++ b/cmd/starlark/starlark.go @@ -4,7 +4,7 @@ // The starlark command interprets a Starlark file. // With no arguments, it starts a read-eval-print loop (REPL). -package main +package main // import "go.starlark.net/cmd/starlark" import ( "flag" @@ -15,9 +15,9 @@ import ( "sort" "strings" - "go.starlark.net/starlark" "go.starlark.net/repl" "go.starlark.net/resolve" + "go.starlark.net/starlark" ) // flags diff --git a/docs/cmd/starlark/index.html b/docs/cmd/starlark/index.html new file mode 100644 index 0000000..29d9c83 --- /dev/null +++ b/docs/cmd/starlark/index.html @@ -0,0 +1,9 @@ +<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/go.starlark.net/cmd/starlark'" /></meta> +</head> +<body> + Redirecting to godoc.org page for go.starlark.net/cmd/starlark... +</body> +</html> diff --git a/docs/index.html b/docs/index.html index e8eb50d..ec44a6e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,6 +6,6 @@ <meta http-equiv="refresh" content="0;URL='http://github.com/google/starlark-go'" /> </head> <body> - Redirecting to github.com/google/starlark-go... + Redirecting to GitHub project github.com/google/starlark-go... </body> </html> diff --git a/docs/internal/chunkedfile/index.html b/docs/internal/chunkedfile/index.html new file mode 100644 index 0000000..7710919 --- /dev/null +++ b/docs/internal/chunkedfile/index.html @@ -0,0 +1,9 @@ +<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/go.starlark.net/internal/chunkedfile'" /></meta> +</head> +<body> + Redirecting to godoc.org page for go.starlark.net/internal/chunkedfile... +</body> +</html> diff --git a/docs/internal/compile/index.html b/docs/internal/compile/index.html new file mode 100644 index 0000000..12eb87f --- /dev/null +++ b/docs/internal/compile/index.html @@ -0,0 +1,9 @@ +<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/go.starlark.net/internal/compile'" /></meta> +</head> +<body> + Redirecting to godoc.org page for go.starlark.net/internal/compile... +</body> +</html> diff --git a/docs/repl/index.html b/docs/repl/index.html new file mode 100644 index 0000000..bbcc4b2 --- /dev/null +++ b/docs/repl/index.html @@ -0,0 +1,9 @@ +<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/go.starlark.net/repl'" /></meta> +</head> +<body> + Redirecting to godoc.org page for go.starlark.net/repl... +</body> +</html> diff --git a/docs/resolve/index.html b/docs/resolve/index.html new file mode 100644 index 0000000..6d63ca6 --- /dev/null +++ b/docs/resolve/index.html @@ -0,0 +1,9 @@ +<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/go.starlark.net/resolve'" /></meta> +</head> +<body> + Redirecting to godoc.org page for go.starlark.net/resolve... +</body> +</html> diff --git a/docs/starlark/index.html b/docs/starlark/index.html new file mode 100644 index 0000000..58e38f0 --- /dev/null +++ b/docs/starlark/index.html @@ -0,0 +1,9 @@ +<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/go.starlark.net/starlark'" /></meta> +</head> +<body> + Redirecting to godoc.org page for go.starlark.net/starlark... +</body> +</html> diff --git a/docs/starlarkstruct/index.html b/docs/starlarkstruct/index.html new file mode 100644 index 0000000..e187004 --- /dev/null +++ b/docs/starlarkstruct/index.html @@ -0,0 +1,9 @@ +<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/go.starlark.net/starlarkstruct'" /></meta> +</head> +<body> + Redirecting to godoc.org page for go.starlark.net/starlarkstruct... +</body> +</html> diff --git a/docs/starlarktest/index.html b/docs/starlarktest/index.html new file mode 100644 index 0000000..d808e12 --- /dev/null +++ b/docs/starlarktest/index.html @@ -0,0 +1,9 @@ +<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/go.starlark.net/starlarktest'" /></meta> +</head> +<body> + Redirecting to godoc.org page for go.starlark.net/starlarktest... +</body> +</html> diff --git a/docs/syntax/index.html b/docs/syntax/index.html new file mode 100644 index 0000000..a629e81 --- /dev/null +++ b/docs/syntax/index.html @@ -0,0 +1,9 @@ +<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/go.starlark.net/syntax'" /></meta> +</head> +<body> + Redirecting to godoc.org page for go.starlark.net/syntax... +</body> +</html> diff --git a/docs/update.go b/docs/update.go new file mode 100644 index 0000000..be40427 --- /dev/null +++ b/docs/update.go @@ -0,0 +1,71 @@ +//+build ignore + +// The update command creates/updates the <html><head> elements of +// each subpackage beneath docs so that "go get" requests redirect +// to GitHub and other HTTP requests redirect to godoc.corp. +// +// Usage: +// +// $ cd $GOPATH/src/go.starlark.net +// $ go run docs/update.go +// +package main + +import ( + "bytes" + "fmt" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "strings" +) + +func main() { + log.SetFlags(0) + log.SetPrefix("update: ") + + cwd, err := os.Getwd() + if err != nil { + log.Fatal(err) + } + if filepath.Base(cwd) != "go.starlark.net" { + log.Fatalf("must run from the go.starlark.net directory") + } + + cmd := exec.Command("go", "list", "./...") + cmd.Stdout = new(bytes.Buffer) + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + log.Fatal(err) + } + for _, pkg := range strings.Split(strings.TrimSpace(fmt.Sprint(cmd.Stdout)), "\n") { + rel := strings.TrimPrefix(pkg, "go.starlark.net/") // e.g. "cmd/starlark" + subdir := filepath.Join("docs", rel) + if err := os.MkdirAll(subdir, 0777); err != nil { + log.Fatal(err) + } + + // Create missing docs/$rel/index.html files. + html := filepath.Join(subdir, "index.html") + if _, err := os.Stat(html); os.IsNotExist(err) { + data := strings.Replace(defaultHTML, "$PKG", pkg, -1) + if err := ioutil.WriteFile(html, []byte(data), 0666); err != nil { + log.Fatal(err) + } + log.Printf("created %s", html) + } + } +} + +const defaultHTML = `<html> +<head> + <meta name="go-import" content="go.starlark.net git https://github.com/google/starlark-go"></meta> + <meta http-equiv="refresh" content="0;URL='http://godoc.org/$PKG'" /></meta> +</head> +<body> + Redirecting to godoc.org page for $PKG... +</body> +</html> +` diff --git a/internal/chunkedfile/chunkedfile.go b/internal/chunkedfile/chunkedfile.go index 9200537..b0e908d 100644 --- a/internal/chunkedfile/chunkedfile.go +++ b/internal/chunkedfile/chunkedfile.go @@ -22,7 +22,7 @@ // then calls chunk.GotError for each error that actually occurred. Any // discrepancy between the actual and expected errors is reported using // the client's reporter, which is typically a testing.T. -package chunkedfile +package chunkedfile // import "go.starlark.net/internal/chunkedfile" import ( "fmt" diff --git a/internal/compile/compile.go b/internal/compile/compile.go index 697fe58..99e9d54 100644 --- a/internal/compile/compile.go +++ b/internal/compile/compile.go @@ -20,7 +20,7 @@ // Operands, logically uint32s, are encoded using little-endian 7-bit // varints, the top bit indicating that more bytes follow. // -package compile +package compile // import "go.starlark.net/internal/compile" import ( "bytes" diff --git a/repl/repl.go b/repl/repl.go index 06d4591..2448192 100644 --- a/repl/repl.go +++ b/repl/repl.go @@ -10,7 +10,7 @@ // expression. If the input still cannot be parsed as an expression, // the REPL parses and executes it as a file (a list of statements), // for side effects. -package repl +package repl // import "go.starlark.net/repl" // TODO(adonovan): // diff --git a/resolve/resolve.go b/resolve/resolve.go index 2ed3cea..9895879 100644 --- a/resolve/resolve.go +++ b/resolve/resolve.go @@ -10,7 +10,7 @@ // free variable. It also sets the Locals array of a File for locals // bound by comprehensions outside any function. Identifiers for global // variables do not get an index. -package resolve +package resolve // import "go.starlark.net/resolve" // All references to names are statically resolved. Names may be // predeclared, global, or local to a function or module-level comprehension. diff --git a/starlarkstruct/struct.go b/starlarkstruct/struct.go index 96ad5e4..819fb2f 100644 --- a/starlarkstruct/struct.go +++ b/starlarkstruct/struct.go @@ -4,7 +4,7 @@ // Package starlarkstruct defines the Starlark 'struct' type, // an optional language extension. -package starlarkstruct +package starlarkstruct // import "go.starlark.net/starlarkstruct" // It is tempting to introduce a variant of Struct that is a wrapper // around a Go struct value, for stronger typing guarantees and more @@ -155,7 +155,7 @@ func (s *Struct) String() string { // Constructor returns the constructor used to create this struct. func (s *Struct) Constructor() starlark.Value { return s.constructor } -func (s *Struct) Type() string { return "struct" } +func (s *Struct) Type() string { return "struct" } func (s *Struct) Truth() starlark.Bool { return true } // even when empty func (s *Struct) Hash() (uint32, error) { // Same algorithm as Tuple.hash, but with different primes. diff --git a/starlarktest/starlarktest.go b/starlarktest/starlarktest.go index e318f5b..4cf315b 100644 --- a/starlarktest/starlarktest.go +++ b/starlarktest/starlarktest.go @@ -10,7 +10,7 @@ // // The assert.error function, which reports errors to the current Go // testing.T, requires that clients call SetTest(thread, t) before use. -package starlarktest +package starlarktest // import "go.starlark.net/starlarktest" import ( "bytes" diff --git a/syntax/syntax.go b/syntax/syntax.go index d40d10e..29b22de 100644 --- a/syntax/syntax.go +++ b/syntax/syntax.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package syntax provides a Starlark parser and abstract syntax tree. -package syntax +package syntax // import "go.starlark.net/syntax" // A Node is a node in a Starlark syntax tree. type Node interface { |