1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

MAINT: Make staticcheck more strict and fix new warnings (#1408)

* Make staticcheck more strict and fix new warnings
This commit is contained in:
Tom Limoncelli
2022-02-11 14:30:45 -05:00
committed by GitHub
parent 25d72395f3
commit 886dbf6d00
16 changed files with 117 additions and 107 deletions

View File

@ -149,7 +149,7 @@ func require(call otto.FunctionCall) otto.Value {
throw(call.Otto, err.Error())
}
var value otto.Value = otto.TrueValue()
var value = otto.TrueValue()
// If its a json file return the json value, else default to true
if strings.HasSuffix(filepath.Ext(relFile), "json") {
@ -194,7 +194,7 @@ func listFiles(call otto.FunctionCall) otto.Value {
}
// Second: Recursive?
var recursive bool = true
var recursive = true
if call.Argument(1).IsDefined() && !call.Argument(1).IsNull() {
if call.Argument(1).IsBoolean() {
recursive, _ = call.Argument(1).ToBoolean() // If it should be recursive
@ -204,7 +204,7 @@ func listFiles(call otto.FunctionCall) otto.Value {
}
// Third: File extension filter.
var fileExtension string = ".js"
var fileExtension = ".js"
if call.Argument(2).IsDefined() && !call.Argument(2).IsNull() {
if call.Argument(2).IsString() {
fileExtension = call.Argument(2).String() // Which file extension to filter for.