MCPcopy Index your code
hub / github.com/google/go-github / saveFile

Method saveFile

tools/metadata/metadata.go:157–180  ·  view source on GitHub ↗
(filename string)

Source from the content-addressed store, hash-verified

155}
156
157func (m *operationsFile) saveFile(filename string) (errOut error) {
158 sortOperations(m.ManualOps)
159 sortOperations(m.OverrideOps)
160 sortOperations(m.OpenapiOps)
161 f, err := os.Create(filename)
162 if err != nil {
163 return err
164 }
165 defer func() {
166 e := f.Close()
167 if errOut == nil {
168 errOut = e
169 }
170 }()
171 enc := yaml.NewEncoder(f)
172 enc.SetIndent(2)
173 defer func() {
174 e := enc.Close()
175 if errOut == nil {
176 errOut = e
177 }
178 }()
179 return enc.Encode(m)
180}
181
182func (m *operationsFile) updateFromGithub(ctx context.Context, client *github.Client, ref string) error {
183 commit, resp, err := client.Repositories.GetCommit(ctx, descriptionsOwnerName, descriptionsRepoName, ref, nil)

Callers 2

RunMethod · 0.80
RunMethod · 0.80

Calls 3

sortOperationsFunction · 0.85
CloseMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected