|
|
|
@ -58,11 +58,13 @@ func HasNoClone(structTag string) bool {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const header = `// Copyright (c) %d Tailscale Inc & AUTHORS All rights reserved.
|
|
|
|
|
const copyrightHeader = `// Copyright (c) %d Tailscale Inc & 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 %v; DO NOT EDIT.
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
const genAndPackageHeader = `// Code generated by %v; DO NOT EDIT.
|
|
|
|
|
|
|
|
|
|
package %s
|
|
|
|
|
`
|
|
|
|
@ -109,7 +111,10 @@ func (it *ImportTracker) Write(w io.Writer) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func writeHeader(w io.Writer, tool, pkg string, copyrightYear int) {
|
|
|
|
|
fmt.Fprintf(w, header, copyrightYear, tool, pkg)
|
|
|
|
|
if copyrightYear != 0 {
|
|
|
|
|
fmt.Fprintf(w, copyrightHeader, copyrightYear)
|
|
|
|
|
}
|
|
|
|
|
fmt.Fprintf(w, genAndPackageHeader, tool, pkg)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WritePackageFile adds a file with the provided imports and contents to package.
|
|
|
|
@ -287,7 +292,8 @@ func CopyrightYear(dir string) (year int) {
|
|
|
|
|
Files:
|
|
|
|
|
for _, f := range files {
|
|
|
|
|
name := f.Name()
|
|
|
|
|
if f.IsDir() ||
|
|
|
|
|
if !f.Type().IsRegular() ||
|
|
|
|
|
strings.HasPrefix(name, ".") || // includes emacs noise
|
|
|
|
|
!strings.HasSuffix(name, ".go") ||
|
|
|
|
|
strings.HasSuffix(name, "_clone.go") ||
|
|
|
|
|
strings.HasSuffix(name, "_view.go") ||
|
|
|
|
@ -312,8 +318,5 @@ Files:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if year == 0 {
|
|
|
|
|
panic("no Copyright line found in any *.go file in " + dir)
|
|
|
|
|
}
|
|
|
|
|
return year
|
|
|
|
|
}
|
|
|
|
|