Skip to content

legacy: some clean-ups of legacy code #2160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Removed unused class
  • Loading branch information
cmaglie committed Apr 27, 2023
commit 302ff5f936e88e3819d3bf7fe6dbedf9d1f18e86
34 changes: 0 additions & 34 deletions legacy/builder/types/accessories.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@

package types

import (
"bytes"
"sync"
)

type UniqueStringQueue []string

func (queue UniqueStringQueue) Len() int { return len(queue) }
Expand Down Expand Up @@ -65,32 +60,3 @@ func (queue *UniqueSourceFileQueue) Pop() SourceFile {
func (queue *UniqueSourceFileQueue) Empty() bool {
return queue.Len() == 0
}

type BufferedUntilNewLineWriter struct {
PrintFunc PrintFunc
Buffer bytes.Buffer
lock sync.Mutex
}

type PrintFunc func([]byte)

func (w *BufferedUntilNewLineWriter) Write(p []byte) (n int, err error) {
w.lock.Lock()
defer w.lock.Unlock()

writtenToBuffer, err := w.Buffer.Write(p)
return writtenToBuffer, err
}

func (w *BufferedUntilNewLineWriter) Flush() {
w.lock.Lock()
defer w.lock.Unlock()

remainingBytes := w.Buffer.Bytes()
if len(remainingBytes) > 0 {
if remainingBytes[len(remainingBytes)-1] != '\n' {
remainingBytes = append(remainingBytes, '\n')
}
w.PrintFunc(remainingBytes)
}
}