代码拉取完成,页面将自动刷新
package ignore
import (
"bytes"
)
// Parse reads in a gitignore file and returns a Matcher
func Parse(src []byte) (Matcher, error) {
matchers := []Matcher{}
lines := bytes.Split(src, []byte{'\n'})
for _, line := range lines {
if len(line) == 0 || len(bytes.TrimSpace(line)) == 0 {
continue
}
if line[0] == '#' {
continue
}
// TODO: line starts with '!'
// TODO: line ends with '\ '
// if starts with \# or \! then escaped
if len(line) > 1 && line[0] == '\\' && (line[1] == '#' || line[1] == '!') {
line = line[1:]
}
m, err := NewGlobMatch(line)
if err != nil {
return nil, err
}
matchers = append(matchers, m)
}
return NewMultiMatch(matchers), nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。