func newIgnoreRuleset(r io.Reader) (ignoreRuleset, error) {
	var (
		lineNo int
		rs     ignoreRuleset
		s      = bufio.NewScanner(r)
	)

	for s.Scan() {
		lineNo++

		// Cleanup leading whitespace; ignore empty and comment lines
		rule := strings.TrimLeftFunc(s.Text(), unicode.IsSpace)
		if len(rule) == 0 || rule[0] == '#' {
			continue
		}

		r, err := compileIgnoreRule(rule)
		if err != nil {
			return nil, errors.Annotatef(err, "[line %d]", lineNo)
		}

		rs = append(rs, r)
	}

	if err := s.Err(); err != nil {
		return nil, err
	}

	return rs, nil
}
// newIgnoreRuleset reads the contents of a .jujuignore file from r and returns
// back an ignoreRuleset that can be used to match files against the set of
// exclusion rules.
//
// .jujuignore files use the same syntax as .gitignore files. For more details
// see: https://git-scm.com/docs/gitignore#_pattern_format
newIgnoreRuleset reads the contents of a .jujuignore file from r and returns
back an ignoreRuleset that can be used to match files against the set of
exclusion rules.

.jujuignore files use the same syntax as .gitignore files.
// newIgnoreRuleset reads the contents of a . jujuignore file from r and returns // back an ignoreRuleset that can be used to match files against the set of // exclusion rules . // // . jujuignore files use the same syntax as . gitignore files . For more details // see : https : // git - scm . com / docs / gitignore#_pattern_format
func newIgnoreRuleset(r io.Reader) (ignoreRuleset, error) {
	var (
		lineNo int
		rs     ignoreRuleset
		s      = bufio.NewScanner(r)
	)
	for s.Scan() {
		lineNo++
		rule := strings.TrimLeftFunc(s.Text(), unicode.IsSpace)
		if len(rule) == 0 || rule[0] == '#' {
			continue
		}
		r, err := compileIgnoreRule(rule)
		if err != nil {
			return nil, errors.Annotatef(err, "[line %d]", lineNo)
		}
		rs = append(rs, r)
	}
	if err := s.Err(); err != nil {
		return nil, err
	}
	return rs, nil
}
func newIgnoreRuleset ( r io . Reader ) ( ignoreRuleset , error ) { var ( lineNo int rs ignoreRuleset s = bufio . NewScanner ( r ) ) for s . Scan ( ) { lineNo ++ rule := strings . TrimLeftFunc ( s . Text ( ) , unicode . IsSpace ) if len ( rule ) == 0 || rule [ 0 ] == '#' { continue } r , err := compileIgnoreRule ( rule ) if err != nil { return nil , errors . Annotatef ( err , " " , lineNo ) } rs = append ( rs , r ) } if err := s . Err ( ) ; err != nil { return nil , err } return rs , nil }
newIgnoreRuleset reads the contents of a .jujuignore file from r and returns
back an ignoreRuleset that can be used to match files against the set of
exclusion rules.
newIgnoreRuleset reads the contents of a . jujuignore file from r and returns back an ignoreRuleset that can be used to match files against the set of exclusion rules .
// Cleanup leading whitespace; ignore empty and comment lines