diff options
author | Cameron Moore <moorereason@gmail.com> | 2018-09-06 10:53:18 -0500 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-09-07 08:25:51 +0200 |
commit | f0effac80426325040c4bc703cd610f434d0b5a8 (patch) | |
tree | 18c011f77f3777bafef9e00d98df302f0572f22f /commands/import_jekyll.go | |
parent | be3ae3ec92da972a55112af39ce2e1c45121b9a5 (diff) |
commands: Fix golint issues
commands/hugo.go:65:1: exported method Response.IsUserError should have comment or be unexported
commands/import_jekyll.go:100:21: error strings should not be capitalized or end with punctuation or a newline
commands/server.go:417:1: receiver name sc should be consistent with previous receiver name s for serverCmd
Diffstat (limited to 'commands/import_jekyll.go')
-rw-r--r-- | commands/import_jekyll.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/commands/import_jekyll.go b/commands/import_jekyll.go index af8a5acb2..6d88a7fd8 100644 --- a/commands/import_jekyll.go +++ b/commands/import_jekyll.go @@ -73,23 +73,23 @@ Import from Jekyll requires two paths, e.g. ` + "`hugo import jekyll jekyll_root func (i *importCmd) importFromJekyll(cmd *cobra.Command, args []string) error { if len(args) < 2 { - return newUserError(`Import from Jekyll requires two paths, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`.") + return newUserError(`import from jekyll requires two paths, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`.") } jekyllRoot, err := filepath.Abs(filepath.Clean(args[0])) if err != nil { - return newUserError("Path error:", args[0]) + return newUserError("path error:", args[0]) } targetDir, err := filepath.Abs(filepath.Clean(args[1])) if err != nil { - return newUserError("Path error:", args[1]) + return newUserError("path error:", args[1]) } jww.INFO.Println("Import Jekyll from:", jekyllRoot, "to:", targetDir) if strings.HasPrefix(filepath.Dir(targetDir), jekyllRoot) { - return newUserError("Target path should not be inside the Jekyll root, aborting.") + return newUserError("abort: target path should not be inside the Jekyll root") } forceImport, _ := cmd.Flags().GetBool("force") @@ -97,7 +97,7 @@ func (i *importCmd) importFromJekyll(cmd *cobra.Command, args []string) error { fs := afero.NewOsFs() jekyllPostDirs, hasAnyPost := i.getJekyllDirInfo(fs, jekyllRoot) if !hasAnyPost { - return errors.New("Your Jekyll root contains neither posts nor drafts, aborting.") + return errors.New("abort: jekyll root contains neither posts nor drafts") } site, err := i.createSiteFromJekyll(jekyllRoot, targetDir, jekyllPostDirs, forceImport) @@ -120,7 +120,7 @@ func (i *importCmd) importFromJekyll(cmd *cobra.Command, args []string) error { relPath, err := filepath.Rel(jekyllRoot, path) if err != nil { - return newUserError("Get rel path error:", path) + return newUserError("get rel path error:", path) } relPath = filepath.ToSlash(relPath) @@ -204,13 +204,13 @@ func (i *importCmd) createSiteFromJekyll(jekyllRoot, targetDir string, jekyllPos fs := s.Fs.Source if exists, _ := helpers.Exists(targetDir, fs); exists { if isDir, _ := helpers.IsDir(targetDir, fs); !isDir { - return nil, errors.New("Target path \"" + targetDir + "\" already exists but not a directory") + return nil, errors.New("target path \"" + targetDir + "\" exists but is not a directory") } isEmpty, _ := helpers.IsEmpty(targetDir, fs) if !isEmpty && !force { - return nil, errors.New("Target path \"" + targetDir + "\" already exists and is not empty") + return nil, errors.New("target path \"" + targetDir + "\" exists and is not empty") } } |