Skip to content

Commit

Permalink
Don't export tempFileResult
Browse files Browse the repository at this point in the history
  • Loading branch information
jblebrun committed Apr 16, 2024
1 parent 294c9b4 commit 7e92966
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/builders/docker/pkg/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,13 @@ func (c *GitClient) checkoutGitCommit() error {
return nil
}

type TempFileResult struct {
type tempFileResult struct {
File *os.File
Err error
}

// A helper function used by saveToTempFile to process one individual file.
func saveOneTempFile(verbose bool, reader io.Reader, fileChannel chan TempFileResult, printChannel chan string) {
func saveOneTempFile(verbose bool, reader io.Reader, fileChannel chan tempFileResult, printChannel chan string) {
var allBytes []byte
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
Expand All @@ -499,15 +499,15 @@ func saveOneTempFile(verbose bool, reader io.Reader, fileChannel chan TempFileRe

tmpfile, err := os.CreateTemp("", "log-*.txt")
if err != nil {
fileChannel <- TempFileResult{Err: err}
fileChannel <- tempFileResult{Err: err}
return
}
if _, err := tmpfile.Write(allBytes); err != nil {
tmpfile.Close()
fileChannel <- TempFileResult{Err: fmt.Errorf("couldn't write bytes to tempfile: %v", err)}
fileChannel <- tempFileResult{Err: fmt.Errorf("couldn't write bytes to tempfile: %v", err)}
}

fileChannel <- TempFileResult{File: tmpfile}
fileChannel <- tempFileResult{File: tmpfile}
}

// saveToTempFile creates a tempfile in `/tmp` and writes the content of the
Expand All @@ -518,7 +518,7 @@ func saveToTempFile(verbose bool, readers ...io.Reader) ([]string, error) {
fmt.Print("\n\n>>>>>>>>>>>>>> output from command <<<<<<<<<<<<<<\n")
}
var wg sync.WaitGroup
var fileChannel = make(chan TempFileResult, len(readers))
var fileChannel = make(chan tempFileResult, len(readers))
var printChannel = make(chan string)

for _, reader := range readers {
Expand Down

0 comments on commit 7e92966

Please sign in to comment.