mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
go.tools/cmd: move static files into new package 'static'
Fixes golang/go#6200. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/12805046
This commit is contained in:
parent
d64ad45594
commit
373fd88c80
@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
|
||||
set -e
|
||||
|
||||
go run bake.go template/* | gofmt > template.go
|
||||
|
@ -49,6 +49,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"code.google.com/p/go.tools/godoc"
|
||||
"code.google.com/p/go.tools/godoc/static"
|
||||
"code.google.com/p/go.tools/godoc/vfs"
|
||||
"code.google.com/p/go.tools/godoc/vfs/mapfs"
|
||||
"code.google.com/p/go.tools/godoc/vfs/zipfs"
|
||||
@ -197,7 +198,7 @@ func main() {
|
||||
if *templateDir != "" {
|
||||
fs.Bind("/lib/godoc", vfs.OS(*templateDir), "/", vfs.BindBefore)
|
||||
} else {
|
||||
fs.Bind("/lib/godoc", mapfs.New(bakedFiles), "/", vfs.BindReplace)
|
||||
fs.Bind("/lib/godoc", mapfs.New(static.Files), "/", vfs.BindReplace)
|
||||
}
|
||||
} else {
|
||||
// use file system specified via .zip file (path separator must be '/')
|
||||
|
@ -33,8 +33,8 @@ func main() {
|
||||
|
||||
func bake(files []string) error {
|
||||
w := bufio.NewWriter(os.Stdout)
|
||||
fmt.Fprintf(w, "%v\n\npackage main\n\n", warning)
|
||||
fmt.Fprintf(w, "var bakedFiles = map[string]string{\n")
|
||||
fmt.Fprintf(w, "%v\n\npackage static\n\n", warning)
|
||||
fmt.Fprintf(w, "var Files = map[string]string{\n")
|
||||
for _, fn := range files {
|
||||
b, err := ioutil.ReadFile(fn)
|
||||
if err != nil {
|
26
godoc/static/bake.sh
Executable file
26
godoc/static/bake.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
|
||||
set -e
|
||||
|
||||
STATIC="
|
||||
codewalk.html
|
||||
codewalkdir.html
|
||||
dirlist.html
|
||||
error.html
|
||||
example.html
|
||||
godoc.html
|
||||
godocs.js
|
||||
jquery.js
|
||||
opensearch.xml
|
||||
package.html
|
||||
package.txt
|
||||
playground.js
|
||||
search.html
|
||||
search.txt
|
||||
style.css
|
||||
"
|
||||
|
||||
go run bake.go $STATIC | gofmt > static.go
|
8
godoc/static/doc.go
Normal file
8
godoc/static/doc.go
Normal file
@ -0,0 +1,8 @@
|
||||
// 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 static exports a map of static file content that supports the godoc
|
||||
// user interface. The map should be used with the mapfs package, see
|
||||
// code.google.com/p/godoc/vfs/mapfs.
|
||||
package static
|
@ -1,8 +1,8 @@
|
||||
// DO NOT EDIT ** This file was generated with the bake tool ** DO NOT EDIT //
|
||||
|
||||
package main
|
||||
package static
|
||||
|
||||
var bakedFiles = map[string]string{
|
||||
var Files = map[string]string{
|
||||
"codewalk.html": `<!--
|
||||
Copyright 2010 The Go Authors. All rights reserved.
|
||||
Use of this source code is governed by a BSD-style
|
Loading…
x
Reference in New Issue
Block a user