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

Function parseInstallScript

site/site.go:673–692  ·  view source on GitHub ↗
(files fs.FS, buildInfo codersdk.BuildInfoResponse)

Source from the content-addressed store, hash-verified

671}
672
673func parseInstallScript(files fs.FS, buildInfo codersdk.BuildInfoResponse) ([]byte, error) {
674 scriptFile, err := fs.ReadFile(files, "install.sh")
675 if err != nil {
676 return nil, err
677 }
678
679 script, err := template.New("install.sh").Parse(string(scriptFile))
680 if err != nil {
681 return nil, err
682 }
683
684 var buf bytes.Buffer
685 state := installScriptState{Origin: buildInfo.DashboardURL, Version: buildInfo.Version}
686 err = script.Execute(&buf, state)
687 if err != nil {
688 return nil, err
689 }
690
691 return buf.Bytes(), nil
692}
693
694// Action represents a link.
695type Action struct {

Callers 1

NewFunction · 0.85

Calls 5

ReadFileMethod · 0.65
ParseMethod · 0.65
NewMethod · 0.65
ExecuteMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected