(inc Includable, projectDir string)
| 15 | ) |
| 16 | |
| 17 | func getConfigIfAny(inc Includable, projectDir string) (*Config, error) { |
| 18 | switch includable := inc.(type) { |
| 19 | case *devpkg.Package: |
| 20 | return getBuiltinPluginConfigIfExists(includable, projectDir) |
| 21 | case *githubPlugin: |
| 22 | content, err := includable.Fetch() |
| 23 | if err != nil { |
| 24 | return nil, errors.WithStack(err) |
| 25 | } |
| 26 | return buildConfig(includable, projectDir, string(content)) |
| 27 | case *gitPlugin: |
| 28 | content, err := includable.Fetch() |
| 29 | if err != nil { |
| 30 | return nil, errors.WithStack(err) |
| 31 | } |
| 32 | return buildConfig(includable, projectDir, string(content)) |
| 33 | case *LocalPlugin: |
| 34 | content, err := os.ReadFile(includable.Path()) |
| 35 | if err != nil && !os.IsNotExist(err) { |
| 36 | return nil, errors.WithStack(err) |
| 37 | } |
| 38 | return buildConfig(includable, projectDir, string(content)) |
| 39 | } |
| 40 | return nil, errors.Errorf("unknown plugin type %T", inc) |
| 41 | } |
| 42 | |
| 43 | func getBuiltinPluginConfigIfExists( |
| 44 | pkg *devpkg.Package, |
no test coverage detected