godoc/static: add license preamble to static file

Change-Id: Icfdb6b544ff8613efc5a183d50efe6bb92dc6784
Reviewed-on: https://go-review.googlesource.com/38165
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Kevin Burke 2017-03-15 15:55:52 -07:00 committed by Brad Fitzpatrick
parent 6185cb1f31
commit 2946dd1f77
2 changed files with 11 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import (
"go/format"
"io/ioutil"
"os"
"time"
"unicode/utf8"
)
@ -84,7 +85,7 @@ func makestatic() error {
}
defer f.Close()
buf := new(bytes.Buffer)
fmt.Fprintf(buf, "%v\npackage static\n\n", warning)
fmt.Fprintf(buf, "%v\n\n%v\n\npackage static\n\n", license, warning)
fmt.Fprintf(buf, "var Files = map[string]string{\n")
for _, fn := range files {
b, err := ioutil.ReadFile(fn)
@ -119,4 +120,8 @@ func sanitize(b []byte) []byte {
return bytes.Replace(b, []byte("\xEF\xBB\xBF"), []byte("`+\"\\xEF\\xBB\\xBF\"+`"), -1)
}
const warning = "// Code generated by \"makestatic\"; DO NOT EDIT\n"
const warning = `// Code generated by "makestatic"; DO NOT EDIT`
var license = fmt.Sprintf(`// Copyright %d 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.`, time.Now().UTC().Year())

View File

@ -1,3 +1,7 @@
// Copyright 2017 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.
// Code generated by "makestatic"; DO NOT EDIT
package static