Drop the uselss else blocks as indicated by golint
This commit is contained in:
parent
faa311bf55
commit
56f8fd4c29
48
zscan.go
48
zscan.go
|
@ -250,14 +250,14 @@ func parseZone(r io.Reader, origin, f string, t chan *Token, include int) {
|
||||||
// Discard, can happen when there is nothing on the
|
// Discard, can happen when there is nothing on the
|
||||||
// line except the RR type
|
// line except the RR type
|
||||||
case zString:
|
case zString:
|
||||||
if ttl, ok := stringToTtl(l.token); !ok {
|
ttl, ok := stringToTtl(l.token)
|
||||||
|
if !ok {
|
||||||
t <- &Token{Error: &ParseError{f, "not a TTL", l}}
|
t <- &Token{Error: &ParseError{f, "not a TTL", l}}
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
h.Ttl = ttl
|
|
||||||
// Don't about the defttl, we should take the $TTL value
|
|
||||||
// defttl = ttl
|
|
||||||
}
|
}
|
||||||
|
h.Ttl = ttl
|
||||||
|
// Don't about the defttl, we should take the $TTL value
|
||||||
|
// defttl = ttl
|
||||||
st = zExpectAnyNoTtlBl
|
st = zExpectAnyNoTtlBl
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -329,12 +329,12 @@ func parseZone(r io.Reader, origin, f string, t chan *Token, include int) {
|
||||||
t <- &Token{Error: e}
|
t <- &Token{Error: e}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ttl, ok := stringToTtl(l.token); !ok {
|
ttl, ok := stringToTtl(l.token)
|
||||||
|
if !ok {
|
||||||
t <- &Token{Error: &ParseError{f, "expecting $TTL value, not this...", l}}
|
t <- &Token{Error: &ParseError{f, "expecting $TTL value, not this...", l}}
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
defttl = ttl
|
|
||||||
}
|
}
|
||||||
|
defttl = ttl
|
||||||
st = zExpectOwnerDir
|
st = zExpectOwnerDir
|
||||||
case zExpectDirOriginBl:
|
case zExpectDirOriginBl:
|
||||||
if l.value != zBlank {
|
if l.value != zBlank {
|
||||||
|
@ -395,13 +395,13 @@ func parseZone(r io.Reader, origin, f string, t chan *Token, include int) {
|
||||||
h.Class = l.torc
|
h.Class = l.torc
|
||||||
st = zExpectAnyNoClassBl
|
st = zExpectAnyNoClassBl
|
||||||
case zString:
|
case zString:
|
||||||
if ttl, ok := stringToTtl(l.token); !ok {
|
ttl, ok := stringToTtl(l.token)
|
||||||
|
if !ok {
|
||||||
t <- &Token{Error: &ParseError{f, "not a TTL", l}}
|
t <- &Token{Error: &ParseError{f, "not a TTL", l}}
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
h.Ttl = ttl
|
|
||||||
// defttl = ttl // don't set the defttl here
|
|
||||||
}
|
}
|
||||||
|
h.Ttl = ttl
|
||||||
|
// defttl = ttl // don't set the defttl here
|
||||||
st = zExpectAnyNoTtlBl
|
st = zExpectAnyNoTtlBl
|
||||||
default:
|
default:
|
||||||
t <- &Token{Error: &ParseError{f, "expecting RR type, TTL or class, not this...", l}}
|
t <- &Token{Error: &ParseError{f, "expecting RR type, TTL or class, not this...", l}}
|
||||||
|
@ -434,13 +434,13 @@ func parseZone(r io.Reader, origin, f string, t chan *Token, include int) {
|
||||||
case zExpectAnyNoClass:
|
case zExpectAnyNoClass:
|
||||||
switch l.value {
|
switch l.value {
|
||||||
case zString:
|
case zString:
|
||||||
if ttl, ok := stringToTtl(l.token); !ok {
|
ttl, ok := stringToTtl(l.token)
|
||||||
|
if !ok {
|
||||||
t <- &Token{Error: &ParseError{f, "not a TTL", l}}
|
t <- &Token{Error: &ParseError{f, "not a TTL", l}}
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
h.Ttl = ttl
|
|
||||||
// defttl = ttl // don't set the def ttl anymore
|
|
||||||
}
|
}
|
||||||
|
h.Ttl = ttl
|
||||||
|
// defttl = ttl // don't set the def ttl anymore
|
||||||
st = zExpectRrtypeBl
|
st = zExpectRrtypeBl
|
||||||
case zRrtpe:
|
case zRrtpe:
|
||||||
h.Rrtype = l.torc
|
h.Rrtype = l.torc
|
||||||
|
@ -567,15 +567,15 @@ func zlexer(s *scan, c chan lex) {
|
||||||
rrtype = true
|
rrtype = true
|
||||||
} else {
|
} else {
|
||||||
if strings.HasPrefix(l.tokenUpper, "TYPE") {
|
if strings.HasPrefix(l.tokenUpper, "TYPE") {
|
||||||
if t, ok := typeToInt(l.token); !ok {
|
t, ok := typeToInt(l.token)
|
||||||
|
if !ok {
|
||||||
l.token = "unknown RR type"
|
l.token = "unknown RR type"
|
||||||
l.err = true
|
l.err = true
|
||||||
c <- l
|
c <- l
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
l.value = zRrtpe
|
|
||||||
l.torc = t
|
|
||||||
}
|
}
|
||||||
|
l.value = zRrtpe
|
||||||
|
l.torc = t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t, ok := StringToClass[l.tokenUpper]; ok {
|
if t, ok := StringToClass[l.tokenUpper]; ok {
|
||||||
|
@ -583,15 +583,15 @@ func zlexer(s *scan, c chan lex) {
|
||||||
l.torc = t
|
l.torc = t
|
||||||
} else {
|
} else {
|
||||||
if strings.HasPrefix(l.tokenUpper, "CLASS") {
|
if strings.HasPrefix(l.tokenUpper, "CLASS") {
|
||||||
if t, ok := classToInt(l.token); !ok {
|
t, ok := classToInt(l.token)
|
||||||
|
if !ok {
|
||||||
l.token = "unknown class"
|
l.token = "unknown class"
|
||||||
l.err = true
|
l.err = true
|
||||||
c <- l
|
c <- l
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
l.value = zClass
|
|
||||||
l.torc = t
|
|
||||||
}
|
}
|
||||||
|
l.value = zClass
|
||||||
|
l.torc = t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue