mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 09:43:17 -04:00 
			
		
		
		
	cleanup code by lint (#3312)
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
This commit is contained in:
		
				
					committed by
					
						 Miek Gieben
						Miek Gieben
					
				
			
			
				
	
			
			
			
						parent
						
							f2df37a1fe
						
					
				
				
					commit
					8af4685587
				
			| @@ -65,8 +65,7 @@ func (k *Kubernetes) nsAddrs(external bool, zone string) []dns.RR { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Create an RR slice of collected IPs | 	// Create an RR slice of collected IPs | ||||||
| 	var rrs []dns.RR | 	rrs := make([]dns.RR, len(svcIPs)) | ||||||
| 	rrs = make([]dns.RR, len(svcIPs)) |  | ||||||
| 	for i, ip := range svcIPs { | 	for i, ip := range svcIPs { | ||||||
| 		if ip.To4() == nil { | 		if ip.To4() == nil { | ||||||
| 			rr := new(dns.AAAA) | 			rr := new(dns.AAAA) | ||||||
|   | |||||||
| @@ -104,9 +104,7 @@ func (rule *regexNameRule) Rewrite(ctx context.Context, state request.Request) R | |||||||
| 	s := rule.Replacement | 	s := rule.Replacement | ||||||
| 	for groupIndex, groupValue := range regexGroups { | 	for groupIndex, groupValue := range regexGroups { | ||||||
| 		groupIndexStr := "{" + strconv.Itoa(groupIndex) + "}" | 		groupIndexStr := "{" + strconv.Itoa(groupIndex) + "}" | ||||||
| 		if strings.Contains(s, groupIndexStr) { | 		s = strings.Replace(s, groupIndexStr, groupValue, -1) | ||||||
| 			s = strings.Replace(s, groupIndexStr, groupValue, -1) |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 	state.Req.Question[0].Name = s | 	state.Req.Question[0].Name = s | ||||||
| 	return RewriteDone | 	return RewriteDone | ||||||
| @@ -264,10 +262,7 @@ func (rule *regexNameRule) GetResponseRule() ResponseRule { return rule.Response | |||||||
|  |  | ||||||
| // hasClosingDot return true if s has a closing dot at the end. | // hasClosingDot return true if s has a closing dot at the end. | ||||||
| func hasClosingDot(s string) bool { | func hasClosingDot(s string) bool { | ||||||
| 	if strings.HasSuffix(s, ".") { | 	return strings.HasSuffix(s, ".") | ||||||
| 		return true |  | ||||||
| 	} |  | ||||||
| 	return false |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // getSubExprUsage return the number of subexpressions used in s. | // getSubExprUsage return the number of subexpressions used in s. | ||||||
|   | |||||||
| @@ -59,9 +59,7 @@ func (r *ResponseReverter) WriteMsg(res *dns.Msg) error { | |||||||
| 					s := rule.Replacement | 					s := rule.Replacement | ||||||
| 					for groupIndex, groupValue := range regexGroups { | 					for groupIndex, groupValue := range regexGroups { | ||||||
| 						groupIndexStr := "{" + strconv.Itoa(groupIndex) + "}" | 						groupIndexStr := "{" + strconv.Itoa(groupIndex) + "}" | ||||||
| 						if strings.Contains(s, groupIndexStr) { | 						s = strings.Replace(s, groupIndexStr, groupValue, -1) | ||||||
| 							s = strings.Replace(s, groupIndexStr, groupValue, -1) |  | ||||||
| 						} |  | ||||||
| 					} | 					} | ||||||
| 					name = s | 					name = s | ||||||
| 					isNameRewritten = true | 					isNameRewritten = true | ||||||
|   | |||||||
| @@ -422,7 +422,7 @@ func optsEqual(a, b []dns.EDNS0) bool { | |||||||
| 				if aa.SourceScope != bb.SourceScope { | 				if aa.SourceScope != bb.SourceScope { | ||||||
| 					return false | 					return false | ||||||
| 				} | 				} | ||||||
| 				if !bytes.Equal(aa.Address, bb.Address) { | 				if !aa.Address.Equal(bb.Address) { | ||||||
| 					return false | 					return false | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
|   | |||||||
| @@ -358,7 +358,7 @@ func (r *Request) Match(reply *dns.Msg) bool { | |||||||
| 		return false | 		return false | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if reply.Response == false { | 	if !reply.Response { | ||||||
| 		return false | 		return false | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user