vgo - trim some uneeded data from struct
This commit is contained in:
		@ -16,7 +16,6 @@ package cmd
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"path"
 | 
					 | 
				
			||||||
	"unicode"
 | 
						"unicode"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/spf13/cobra"
 | 
						"github.com/spf13/cobra"
 | 
				
			||||||
@ -60,10 +59,10 @@ Example: cobra add server -> resulting in a new cmd/server.go`,
 | 
				
			|||||||
				CmdParent: parentName,
 | 
									CmdParent: parentName,
 | 
				
			||||||
				Project: &Project{
 | 
									Project: &Project{
 | 
				
			||||||
					AbsolutePath: fmt.Sprintf("%s/cmd", wd),
 | 
										AbsolutePath: fmt.Sprintf("%s/cmd", wd),
 | 
				
			||||||
					AppName:      path.Base(packageName),
 | 
										//AppName:      path.Base(packageName),
 | 
				
			||||||
					PkgName:      packageName,
 | 
										//PkgName:      packageName,
 | 
				
			||||||
					Legal:        getLicense(),
 | 
										Legal:     getLicense(),
 | 
				
			||||||
					Copyright:    copyrightLine(),
 | 
										Copyright: copyrightLine(),
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -91,7 +91,17 @@ func (p *Project) createLicenseFile() error {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (c *Command) Create() error {
 | 
					func (c *Command) Create() error {
 | 
				
			||||||
	return nil
 | 
						cmdFile, err := os.Create(fmt.Sprintf("%s/cmd/%s.go", c.Project.AbsolutePath, c.CmdName))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						defer cmdFile.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						commandTemplate := template.Must(template.New("sub").Parse(string(tpl.AddCommandTemplate())))
 | 
				
			||||||
 | 
						err = commandTemplate.Execute(cmdFile, c.Project.AbsolutePath)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NewProject returns Project with specified project name.
 | 
					// NewProject returns Project with specified project name.
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user