cmd: Small fixes
This commit is contained in:
		
				
					committed by
					
						
						Anthony Fok
					
				
			
			
				
	
			
			
			
						parent
						
							d7ba19510d
						
					
				
				
					commit
					99838a52fe
				
			@ -22,9 +22,9 @@ func TestGoldenAddCmd(t *testing.T) {
 | 
			
		||||
	// Initialize the project at first.
 | 
			
		||||
	initializeProject(project)
 | 
			
		||||
	defer os.RemoveAll(project.AbsPath())
 | 
			
		||||
	defer viper.Set("year", nil)
 | 
			
		||||
 | 
			
		||||
	viper.Set("year", 2017) // For reproducible builds
 | 
			
		||||
	viper.Set("year", 2017) // For reproducible builds.
 | 
			
		||||
	defer viper.Set("year", nil)
 | 
			
		||||
 | 
			
		||||
	// Then add the "test" command.
 | 
			
		||||
	cmdName := "test"
 | 
			
		||||
 | 
			
		||||
@ -18,9 +18,9 @@ func TestGoldenInitCmd(t *testing.T) {
 | 
			
		||||
	projectName := "github.com/spf13/testproject"
 | 
			
		||||
	project := NewProject(projectName)
 | 
			
		||||
	defer os.RemoveAll(project.AbsPath())
 | 
			
		||||
	defer viper.Set("year", nil)
 | 
			
		||||
 | 
			
		||||
	viper.Set("year", 2017) // For reproducible builds
 | 
			
		||||
	viper.Set("year", 2017) // For reproducible builds.
 | 
			
		||||
	defer viper.Set("year", nil)
 | 
			
		||||
 | 
			
		||||
	os.Args = []string{"cobra", "init", projectName}
 | 
			
		||||
	if err := rootCmd.Execute(); err != nil {
 | 
			
		||||
 | 
			
		||||
@ -78,7 +78,7 @@ func getLicense() License {
 | 
			
		||||
func copyrightLine() string {
 | 
			
		||||
	author := viper.GetString("author")
 | 
			
		||||
 | 
			
		||||
	year := viper.GetString("year") // For reproducible builds
 | 
			
		||||
	year := viper.GetString("year") // For tests.
 | 
			
		||||
	if year == "" {
 | 
			
		||||
		year = time.Now().Format("2006")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user