Insert "generated by" comments

This allows Github to suppress diffs in generated files.
This commit is contained in:
Tamir Duberstein 2015-05-27 19:52:02 -04:00
parent e01811006d
commit 36d53ead3a
6 changed files with 58 additions and 0 deletions

View File

@ -49,6 +49,29 @@ func Translate(c *Config) error {
bfd := bufio.NewWriter(fd)
defer bfd.Flush()
// Write the header. This makes e.g. Github ignore diffs in generated files.
if _, err = fmt.Fprint(bfd, "// Code generated by go-bindata.\n"); err != nil {
return err
}
if _, err = fmt.Fprint(bfd, "// sources:\n"); err != nil {
return err
}
wd, err := os.Getwd()
if err != nil {
return err
}
for _, asset := range toc {
relative, _ := filepath.Rel(wd, asset.Path)
if _, err = fmt.Fprintf(bfd, "// %s\n", relative); err != nil {
return err
}
}
if _, err = fmt.Fprint(bfd, "// DO NOT EDIT!\n"); err != nil {
return err
}
// Write build tags, if applicable.
if len(c.Tags) > 0 {
if _, err = fmt.Fprintf(bfd, "// +build %s\n\n", c.Tags); err != nil {

View File

@ -1,3 +1,10 @@
// Code generated by go-bindata.
// sources:
// in/a/test.asset
// in/b/test.asset
// in/c/test.asset
// in/test.asset
// DO NOT EDIT!
package main
import (

View File

@ -1,3 +1,10 @@
// Code generated by go-bindata.
// sources:
// in/a/test.asset
// in/b/test.asset
// in/c/test.asset
// in/test.asset
// DO NOT EDIT!
package main
import (

View File

@ -1,3 +1,10 @@
// Code generated by go-bindata.
// sources:
// in/a/test.asset
// in/b/test.asset
// in/c/test.asset
// in/test.asset
// DO NOT EDIT!
package main
import (

View File

@ -1,3 +1,10 @@
// Code generated by go-bindata.
// sources:
// in/a/test.asset
// in/b/test.asset
// in/c/test.asset
// in/test.asset
// DO NOT EDIT!
package main
import (

View File

@ -1,3 +1,10 @@
// Code generated by go-bindata.
// sources:
// in/a/test.asset
// in/b/test.asset
// in/c/test.asset
// in/test.asset
// DO NOT EDIT!
package main
import (