@@ -88,20 +88,23 @@ func initializePath(path string) {
8888}
8989
9090func createLicenseFile () {
91- data := make ( map [ string ] interface {} )
91+ lic := getLicense ( )
9292
93- // Try to remove the email address, if any
94- data ["copyright" ] = strings .Split (copyrightLine (), " <" )[0 ]
93+ // Don't bother writing a LICENSE file if there is no text.
94+ if lic .Text != "" {
95+ data := make (map [string ]interface {})
9596
96- data ["appName" ] = projectName ()
97+ // Try to remove the email address, if any
98+ data ["copyright" ] = strings .Split (copyrightLine (), " <" )[0 ]
9799
98- // Get license and generate the template from text and data.
99- lic := getLicense ()
100- r , _ := templateToReader (lic .Text , data )
101- buf := new (bytes.Buffer )
102- buf .ReadFrom (r )
103- if template := buf .String (); template != "" {
104- err := writeTemplateToFile (ProjectPath (), "LICENSE" , template , data )
100+ data ["appName" ] = projectName ()
101+
102+ // Generate license template from text and data.
103+ r , _ := templateToReader (lic .Text , data )
104+ buf := new (bytes.Buffer )
105+ buf .ReadFrom (r )
106+
107+ err := writeTemplateToFile (ProjectPath (), "LICENSE" , buf .String (), data )
105108 _ = err
106109 // if err != nil {
107110 // er(err)
0 commit comments