MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/buildpacks / renderRunScript

Function renderRunScript

pkg/devsync/devsync.go:52–66  ·  view source on GitHub ↗
(serviceDir, webCmd string)

Source from the content-addressed store, hash-verified

50}
51
52func renderRunScript(serviceDir, webCmd string) error {
53 templatePath := filepath.Join(serviceDir, "app", "run.template")
54 runPath := filepath.Join(serviceDir, "app", "run")
55
56 content, err := os.ReadFile(templatePath)
57 if err != nil {
58 return fmt.Errorf("reading run.template: %w", err)
59 }
60 replaced := strings.ReplaceAll(string(content), "{{ENTRYPOINT}}", webCmd)
61
62 if err := os.WriteFile(runPath, []byte(replaced), 0755); err != nil {
63 return fmt.Errorf("writing app/run: %w", err)
64 }
65 return nil
66}

Callers 1

UpdateAppRunScriptFunction · 0.85

Calls 2

ReadFileMethod · 0.80
WriteFileMethod · 0.80

Tested by

no test coverage detected