Moved stripComments to read.go.
This commit is contained in:
		
							parent
							
								
									06ccb310d5
								
							
						
					
					
						commit
						8f74ead862
					
				
					 2 changed files with 10 additions and 12 deletions
				
			
		
							
								
								
									
										12
									
								
								conf.go
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								conf.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -160,18 +160,6 @@ func NewConfigFile() *ConfigFile {
 | 
			
		|||
	return c
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func stripComments(l string) string {
 | 
			
		||||
	// comments are preceded by space or TAB
 | 
			
		||||
	for _, c := range []string{" ;", "\t;", " #", "\t#"} {
 | 
			
		||||
		if i := strings.Index(l, c); i != -1 {
 | 
			
		||||
			l = l[0:i]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return l
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func firstIndex(s string, delim []byte) int {
 | 
			
		||||
	for i := 0; i < len(s); i++ {
 | 
			
		||||
		for j := 0; j < len(delim); j++ {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								read.go
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								read.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -109,3 +109,13 @@ func (c *ConfigFile) Read(reader io.Reader) (err os.Error) {
 | 
			
		|||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func stripComments(l string) string {
 | 
			
		||||
	// comments are preceded by space or TAB
 | 
			
		||||
	for _, c := range []string{" ;", "\t;", " #", "\t#"} {
 | 
			
		||||
		if i := strings.Index(l, c); i != -1 {
 | 
			
		||||
			l = l[0:i]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return l
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue