MCPcopy Create free account
hub / github.com/cloudbase/garm / GetOS

Method GetOS

workers/cache/gitea_tools.go:93–111  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91}
92
93func (g GiteaToolsAssets) GetOS() (*string, error) {
94 if g.Name == "" {
95 return nil, fmt.Errorf("gitea tools name is empty")
96 }
97
98 remainder, err := stripRunnerPrefix(g.Name)
99 if err != nil {
100 return nil, fmt.Errorf("could not parse asset name: %w", err)
101 }
102
103 // remainder is "{version}-{os}-{arch}[.exe]"
104 parts := strings.SplitN(remainder, "-", 3)
105 if len(parts) != 3 {
106 return nil, fmt.Errorf("could not parse asset name")
107 }
108
109 os := parts[1]
110 return &os, nil
111}
112
113func (g GiteaToolsAssets) GetArch() (*string, error) {
114 if g.Name == "" {

Callers 1

getToolsFunction · 0.80

Calls 1

stripRunnerPrefixFunction · 0.85

Tested by

no test coverage detected