Skip to content

Commit 3532f19

Browse files
authored
fix: format state yaml with indent of 2 for passing lint (#2149)
Fixes #2116
1 parent a57e5fd commit 3532f19

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/librarian/state.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package librarian
1616

1717
import (
18+
"bytes"
1819
"encoding/json"
1920
"errors"
2021
"fmt"
@@ -152,11 +153,14 @@ func findServiceConfigIn(path string) (string, error) {
152153

153154
func saveLibrarianState(repoDir string, state *config.LibrarianState) error {
154155
path := filepath.Join(repoDir, config.LibrarianDir, librarianStateFile)
155-
bytes, err := yaml.Marshal(state)
156+
var buffer bytes.Buffer
157+
encoder := yaml.NewEncoder(&buffer)
158+
encoder.SetIndent(2)
159+
err := encoder.Encode(state)
156160
if err != nil {
157161
return err
158162
}
159-
return os.WriteFile(path, bytes, 0644)
163+
return os.WriteFile(path, buffer.Bytes(), 0644)
160164
}
161165

162166
// readLibraryState reads the library state from a container response, if it exists.

0 commit comments

Comments
 (0)