Change generator default license to none

It's questionable that a default license makes any sense from a legal perspective.
If the tool created the license without the user choosing it, then it may not even be applicable.
Best to let the user choose their license with intent.
This commit is contained in:
Steve Francia 2021-07-01 17:45:46 -04:00
parent dcf42b25f7
commit c9edb78acc
4 changed files with 7 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import (
func TestGoldenAddCmd(t *testing.T) { func TestGoldenAddCmd(t *testing.T) {
viper.Set("useViper", true) viper.Set("useViper", true)
viper.Set("license", "apache")
command := &Command{ command := &Command{
CmdName: "test", CmdName: "test",
CmdParent: parentName, CmdParent: parentName,

View File

@ -61,6 +61,7 @@ func TestGoldenInitCmd(t *testing.T) {
assertNoErr(t, initCmd.Flags().Set("pkg-name", tt.pkgName)) assertNoErr(t, initCmd.Flags().Set("pkg-name", tt.pkgName))
viper.Set("useViper", true) viper.Set("useViper", true)
viper.Set("license", "apache")
projectPath, err := initializeProject(tt.args) projectPath, err := initializeProject(tt.args)
defer func() { defer func() {
if projectPath != "" { if projectPath != "" {

View File

@ -1,4 +1,4 @@
// Copyright © 2015 Steve Francia <spf@spf13.com>. // Copyright © 2021 Steve Francia <spf@spf13.com>.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -53,7 +53,7 @@ func init() {
} }
// getLicense returns license specified by user in flag or in config. // getLicense returns license specified by user in flag or in config.
// If user didn't specify the license, it returns Apache License 2.0. // If user didn't specify the license, it returns none
// //
// TODO: Inspect project for existing license // TODO: Inspect project for existing license
func getLicense() License { func getLicense() License {
@ -73,8 +73,8 @@ func getLicense() License {
return findLicense(viper.GetString("license")) return findLicense(viper.GetString("license"))
} }
// If user didn't set any license, use Apache 2.0 by default. // If user didn't set any license, use none by default
return Licenses["apache"] return Licenses["none"]
} }
func copyrightLine() string { func copyrightLine() string {

View File

@ -50,7 +50,7 @@ func init() {
cobra.CheckErr(viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author"))) cobra.CheckErr(viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")))
cobra.CheckErr(viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper"))) cobra.CheckErr(viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper")))
viper.SetDefault("author", "NAME HERE <EMAIL ADDRESS>") viper.SetDefault("author", "NAME HERE <EMAIL ADDRESS>")
viper.SetDefault("license", "apache") viper.SetDefault("license", "none")
rootCmd.AddCommand(addCmd) rootCmd.AddCommand(addCmd)
rootCmd.AddCommand(initCmd) rootCmd.AddCommand(initCmd)