github.com/blend/go-sdk@v1.20220411.3/codeowners/file.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package codeowners 9 10 import "io" 11 12 // File is a collection of codeowner sources. 13 type File []Source 14 15 // WriteTo writes the file to a given writer. 16 func (f File) WriteTo(wr io.Writer) (total int64, err error) { 17 var n int 18 var ln int64 19 n, err = io.WriteString(wr, OwnersFileHeader+"\n") 20 if err != nil { 21 return 22 } 23 total += int64(n) 24 25 for _, co := range f { 26 ln, err = co.WriteTo(wr) 27 if err != nil { 28 return 29 } 30 total += int64(ln) 31 } 32 return 33 }