浏览代码

Minor cleanups to keep the linter happy

* Unexported:
  - QuestionCallback
  - SliceToStringSet

* Unreachable return in parser.go

* Unneded else in dependencies.go

* Punctuation in error message in install.go
Sergio Correia 7 年之前
父节点
当前提交
9f62663888
共有 5 个文件被更改,包括 6 次插入9 次删除
  1. 1 1
      callbacks.go
  2. 1 1
      cmd.go
  3. 1 2
      dependencies.go
  4. 1 1
      install.go
  5. 2 4
      parser.go

+ 1 - 1
callbacks.go

@@ -4,7 +4,7 @@ import (
 	alpm "github.com/jguer/go-alpm"
 )
 
-func QuestionCallback(question alpm.QuestionAny) {
+func questionCallback(question alpm.QuestionAny) {
 	q, err := question.QuestionInstallIgnorepkg()
 	if err == nil {
 		q.SetInstall(true)

+ 1 - 1
cmd.go

@@ -224,7 +224,7 @@ func initAlpm() (err error) {
 		return
 	}
 
-	alpmHandle.SetQuestionCallback(QuestionCallback)
+	alpmHandle.SetQuestionCallback(questionCallback)
 
 	return
 }

+ 1 - 2
dependencies.go

@@ -63,9 +63,8 @@ func splitDbFromName(pkg string) (string, string) {
 
 	if len(split) == 2 {
 		return split[0], split[1]
-	} else {
-		return "", split[0]
 	}
+	return "", split[0]
 }
 
 // Step two of dependency resolving. We already have all the information on the

+ 1 - 1
install.go

@@ -145,7 +145,7 @@ func install(parser *arguments) error {
 	if !parser.existsArg("gendb") && len(arguments.targets) > 0 {
 		err := passToPacman(arguments)
 		if err != nil {
-			return fmt.Errorf("Error installing repo packages.")
+			return fmt.Errorf("Error installing repo packages")
 		}
 
 		depArguments := makeArguments()

+ 2 - 4
parser.go

@@ -39,7 +39,7 @@ func (set stringSet) toSlice() []string {
 	return slice
 }
 
-func SliceToStringSet(in []string) stringSet {
+func sliceToStringSet(in []string) stringSet {
 	set := make(stringSet)
 
 	for _, v := range in {
@@ -50,7 +50,7 @@ func SliceToStringSet(in []string) stringSet {
 }
 
 func makeStringSet(in ...string) stringSet {
-	return SliceToStringSet(in)
+	return sliceToStringSet(in)
 }
 
 // Parses command line arguments in a way we can interact with programmatically but
@@ -519,8 +519,6 @@ func (parser *arguments) parseStdin() (err error) {
 
 		parser.addTarget(target)
 	}
-
-	return
 }
 
 func (parser *arguments) parseCommandLine() (err error) {