added bsd license header

This commit is contained in:
Brad Rydzewski
2017-12-07 15:36:14 -08:00
parent 04bf3e3e19
commit 40c31bd566
2 changed files with 6 additions and 1 deletions

View File

@@ -44,7 +44,7 @@ Flags:
var ( var (
holder = flag.String("c", "Google Inc.", "copyright holder") holder = flag.String("c", "Google Inc.", "copyright holder")
license = flag.String("l", "apache", "license type: apache, mit") license = flag.String("l", "apache", "license type: apache, bsd, mit")
year = flag.Int("y", time.Now().Year(), "year") year = flag.Int("y", time.Now().Year(), "year")
) )

View File

@@ -25,6 +25,7 @@ var licenseTemplate = make(map[string]*template.Template)
func init() { func init() {
licenseTemplate["apache"] = template.Must(template.New("").Parse(tmplApache)) licenseTemplate["apache"] = template.Must(template.New("").Parse(tmplApache))
licenseTemplate["mit"] = template.Must(template.New("").Parse(tmplMIT)) licenseTemplate["mit"] = template.Must(template.New("").Parse(tmplMIT))
licenseTemplate["bsd"] = template.Must(template.New("").Parse(tmplBSD))
} }
type copyrightData struct { type copyrightData struct {
@@ -78,6 +79,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License.` limitations under the License.`
const tmplBSD = `Copyright (c) {{.Year}} {{.Holder}} All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.`
const tmplMIT = `Copyright (c) {{.Year}} {{.Holder}} const tmplMIT = `Copyright (c) {{.Year}} {{.Holder}}
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of