INNER CODE UNIT · Go

applyGoEnvs

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

func applyGoEnvs(ctx *buildContext) error {
	if len(ctx.Config.Project.GoEnvs) == 0 {
		return nil
	}
	for k, v := range ctx.Config.Project.GoEnvs {
		value := fmt.Sprintf("%s=%s", k, v)
		cmd := exec.Command(ctx.GoExe, "env", "-w", value)
		cmd.Dir = ctx.ProjectRoot
		out, err := cmd.CombinedOutput()
		if err != nil {
			return fmt.Errorf("failed to apply go env, err: %w, output: %s", err, out)
		}
		fmt.Println("apply go env:", k, v)
	}
	return nil
}

func getGoModules(ctx *buildContext) error {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…