Correct all complaints from golint

* i.e.
* go get golang.org/x/lint/golint
* go list ./... | xargs golint
This commit is contained in:
Bruce Downs
2019-07-30 15:26:11 -07:00
committed by Albert Nigmatzianov
parent 9334a46bd6
commit 51f06c7dd1
6 changed files with 19 additions and 11 deletions

View File

@ -2,9 +2,10 @@ package cmd
import (
"fmt"
"github.com/spf13/cobra/cobra/tpl"
"os"
"text/template"
"github.com/spf13/cobra/cobra/tpl"
)
// Project contains name, license and paths to projects.
@ -18,14 +19,15 @@ type Project struct {
AppName string
}
// Command structure
type Command struct {
CmdName string
CmdParent string
*Project
}
// Create project receiver
func (p *Project) Create() error {
// check if AbsolutePath exists
if _, err := os.Stat(p.AbsolutePath); os.IsNotExist(err) {
// create directory
@ -80,6 +82,7 @@ func (p *Project) createLicenseFile() error {
return licenseTemplate.Execute(licenseFile, data)
}
// Create command receiver
func (c *Command) Create() error {
cmdFile, err := os.Create(fmt.Sprintf("%s/cmd/%s.go", c.AbsolutePath, c.CmdName))
if err != nil {

View File

@ -1,5 +1,6 @@
package tpl
// MainTemplate defines main template string
func MainTemplate() []byte {
return []byte(`/*
{{ .Copyright }}
@ -15,6 +16,7 @@ func main() {
`)
}
// RootTemplate defines root template string
func RootTemplate() []byte {
return []byte(`/*
{{ .Copyright }}
@ -108,6 +110,7 @@ func initConfig() {
`)
}
// AddCommandTemplate defines add command template string
func AddCommandTemplate() []byte {
return []byte(`/*
{{ .Project.Copyright }}