INNER CODE UNIT · Go

loadPluginConfig

alibaba/loongcollector · tools/builder/main.go:111

func loadPluginConfig(file string) (*pluginConfig, error) {
	var content []byte
	if ok, _ := regexp.MatchString("^http(s)?://", strings.ToLower(file)); ok {
		resp, err := http.Get(file) // nolint
		if err != nil {
			return nil, err
		}
		defer resp.Body.Close()
		content, err = io.ReadAll(resp.Body)
		if err != nil {
			return nil, err
		}
	} else {
		var err error
		content, err = os.ReadFile(file) // nolint
		if err != nil {
			return nil, err
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…