mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-07-29 23:49:08 -04:00
feat: create output directory (#4524)
This commit is contained in:
parent
7ad5ccb65b
commit
d37a3e0951
1 changed files with 6 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/golangci/golangci-lint/pkg/config"
|
||||
|
@ -99,6 +100,11 @@ func (c *Printer) createWriter(path string) (io.Writer, bool, error) {
|
|||
return c.stdErr, false, nil
|
||||
}
|
||||
|
||||
err := os.MkdirAll(filepath.Dir(path), os.ModePerm)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
||||
f, err := os.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, defaultFileMode)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue