MCPcopy Index your code
hub / github.com/coder/coder / loadPatterns

Function loadPatterns

agent/agentcontainers/ignore/dir.go:96–115  ·  view source on GitHub ↗
(fileSystem afero.Fs, path string)

Source from the content-addressed store, hash-verified

94}
95
96func loadPatterns(fileSystem afero.Fs, path string) ([]gitignore.Pattern, error) {
97 data, err := afero.ReadFile(fileSystem, path)
98 if err != nil && !errors.Is(err, os.ErrNotExist) {
99 return nil, err
100 }
101
102 decoder := config.NewDecoder(bytes.NewBuffer(data))
103
104 conf := config.New()
105 if err := decoder.Decode(conf); err != nil {
106 return nil, xerrors.Errorf("decode config: %w", err)
107 }
108
109 excludes := conf.Section("core").Options.Get("excludesfile")
110 if excludes == "" {
111 return nil, nil
112 }
113
114 return readIgnoreFile(fileSystem, "", excludes)
115}
116
117func LoadGlobalPatterns(fileSystem afero.Fs) ([]gitignore.Pattern, error) {
118 home, err := os.UserHomeDir()

Callers 1

LoadGlobalPatternsFunction · 0.85

Calls 6

readIgnoreFileFunction · 0.85
ReadFileMethod · 0.65
NewMethod · 0.65
GetMethod · 0.65
IsMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected