From a1b7d3cc4d935b14f3f9803997341d65c3738870 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Sun, 30 Jul 2017 02:15:55 -0600 Subject: [PATCH] cmd: Add a blank line between copyright and license --- cobra/cmd/add.go | 3 ++- cobra/cmd/init.go | 6 ++++-- cobra/cmd/testdata/main.go.golden | 1 + cobra/cmd/testdata/root.go.golden | 1 + cobra/cmd/testdata/test.go.golden | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cobra/cmd/add.go b/cobra/cmd/add.go index 45f00bb5..c97ce844 100644 --- a/cobra/cmd/add.go +++ b/cobra/cmd/add.go @@ -121,7 +121,8 @@ func validateCmdName(source string) string { func createCmdFile(license License, path, cmdName string) { template := `{{comment .copyright}} -{{comment .license}} +{{if .license}}// +{{comment .license}}{{end}} package {{.cmdPackage}} diff --git a/cobra/cmd/init.go b/cobra/cmd/init.go index 149aabe1..2338b4fc 100644 --- a/cobra/cmd/init.go +++ b/cobra/cmd/init.go @@ -107,7 +107,8 @@ func createLicenseFile(license License, path string) { func createMainFile(project *Project) { mainTemplate := `{{ comment .copyright }} -{{if .license}}{{ comment .license }}{{end}} +{{if .license}}// +{{ comment .license }}{{end}} package main @@ -135,7 +136,8 @@ func main() { func createRootCmdFile(project *Project) { template := `{{comment .copyright}} -{{if .license}}{{comment .license}}{{end}} +{{if .license}}// +{{comment .license}}{{end}} package cmd diff --git a/cobra/cmd/testdata/main.go.golden b/cobra/cmd/testdata/main.go.golden index 69ecbd48..cdbe38d7 100644 --- a/cobra/cmd/testdata/main.go.golden +++ b/cobra/cmd/testdata/main.go.golden @@ -1,4 +1,5 @@ // Copyright © 2017 NAME HERE +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/cobra/cmd/testdata/root.go.golden b/cobra/cmd/testdata/root.go.golden index ecc87601..8eeeae89 100644 --- a/cobra/cmd/testdata/root.go.golden +++ b/cobra/cmd/testdata/root.go.golden @@ -1,4 +1,5 @@ // Copyright © 2017 NAME HERE +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/cobra/cmd/testdata/test.go.golden b/cobra/cmd/testdata/test.go.golden index c8319d1d..58405680 100644 --- a/cobra/cmd/testdata/test.go.golden +++ b/cobra/cmd/testdata/test.go.golden @@ -1,4 +1,5 @@ // Copyright © 2017 NAME HERE +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at