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>
diff --git a/godoc/static/makestatic.go b/godoc/static/makestatic.go
index 3886eb2..9cc69e3 100644
--- a/godoc/static/makestatic.go
+++ b/godoc/static/makestatic.go
@@ -15,6 +15,7 @@
"go/format"
"io/ioutil"
"os"
+ "time"
"unicode/utf8"
)
@@ -84,7 +85,7 @@
}
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 @@
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())
diff --git a/godoc/static/static.go b/godoc/static/static.go
index 5855c1d..a428660 100644
--- a/godoc/static/static.go
+++ b/godoc/static/static.go
@@ -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