Skip to content

Commit

Permalink
handle linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
miniscruff committed Mar 17, 2024
1 parent 3deb2ce commit ef2a1a6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ func writeType(writer io.Writer, typeProps TypeProps) error {
buildSourceAnchorLink(anchor, typeProps.File, typeProps.Line),
typeProps.Doc,
)))

if err != nil {
return err
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ func TestErrorInitBadWriteFiles(t *testing.T) {

mockWriteFile := func(path string, data []byte, perm os.FileMode) error {
t.Log(path, filepath.Join(tc.path...))

if path == filepath.Join(tc.path...) {
return mockError
}

return nil
}

Expand Down
1 change: 1 addition & 0 deletions cmd/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (m *Merge) mergeProject(
if changeErr != nil {
return changeErr
}

defer changeFile.Close()
writer = changeFile
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ func (n *New) Run(cmd *cobra.Command, args []string) error {
writer = n.OutOrStdout()
} else {
var fragmentWriter strings.Builder

fileErr := n.TemplateCache.Execute(config.FragmentFileFormat, &fragmentWriter, change)
if fileErr != nil {
return fileErr
}

fragmentWriter.WriteString(".yaml")
outputFilename := fragmentWriter.String()

Expand All @@ -154,6 +156,7 @@ func (n *New) Run(cmd *cobra.Command, args []string) error {
outputFilename = replacer.Replace(outputFilename)

outputPath := filepath.Join(config.ChangesDir, config.UnreleasedDir, outputFilename)

fileErr = n.MkdirAll(filepath.Dir(outputPath), core.CreateDirMode)
if fileErr != nil {
return fileErr
Expand Down
1 change: 1 addition & 0 deletions then/stdin.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func WithReadWritePipe(t *testing.T) (*os.File, *os.File) {
if err := reader.Close(); err != nil {
t.Fatal("failure to close reader:", err)
}

if err := writer.Close(); err != nil {
t.Fatal("failure to close writer:", err)
}
Expand Down

0 comments on commit ef2a1a6

Please sign in to comment.