2
main.go
2
main.go
@@ -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")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
5
tmpl.go
5
tmpl.go
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user