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) {
viper.Set("useViper", true)
viper.Set("license", "apache")
command := &Command{
CmdName: "test",
CmdParent: parentName,

View file

@ -61,6 +61,7 @@ func TestGoldenInitCmd(t *testing.T) {
assertNoErr(t, initCmd.Flags().Set("pkg-name", tt.pkgName))
viper.Set("useViper", true)
viper.Set("license", "apache")
projectPath, err := initializeProject(tt.args)
defer func() {
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");
// 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.
// 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
func getLicense() License {
@ -73,8 +73,8 @@ func getLicense() License {
return findLicense(viper.GetString("license"))
}
// If user didn't set any license, use Apache 2.0 by default.
return Licenses["apache"]
// If user didn't set any license, use none by default
return Licenses["none"]
}
func copyrightLine() string {

View file

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