Skip to content

Commit 8e4a944

Browse files
committed
Windows: do not export Writer
Do not expose symbol 'Writer'. That symbol is purely internal and was only exported on GOOS=windows.
1 parent 11a925c commit 8e4a944

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

colorable_windows.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ var (
8787
procCreateConsoleScreenBuffer = kernel32.NewProc("CreateConsoleScreenBuffer")
8888
)
8989

90-
// Writer provides colorable Writer to the console
91-
type Writer struct {
90+
// writer provides colorable Writer to the console
91+
type writer struct {
9292
out io.Writer
9393
handle syscall.Handle
9494
althandle syscall.Handle
@@ -98,7 +98,7 @@ type Writer struct {
9898
mutex sync.Mutex
9999
}
100100

101-
// NewColorable returns new instance of Writer which handles escape sequence from File.
101+
// NewColorable returns new instance of writer which handles escape sequence from File.
102102
func NewColorable(file *os.File) io.Writer {
103103
if file == nil {
104104
panic("nil passed instead of *os.File to NewColorable()")
@@ -112,17 +112,17 @@ func NewColorable(file *os.File) io.Writer {
112112
var csbi consoleScreenBufferInfo
113113
handle := syscall.Handle(file.Fd())
114114
procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
115-
return &Writer{out: file, handle: handle, oldattr: csbi.attributes, oldpos: coord{0, 0}}
115+
return &writer{out: file, handle: handle, oldattr: csbi.attributes, oldpos: coord{0, 0}}
116116
}
117117
return file
118118
}
119119

120-
// NewColorableStdout returns new instance of Writer which handles escape sequence for stdout.
120+
// NewColorableStdout returns new instance of writer which handles escape sequence for stdout.
121121
func NewColorableStdout() io.Writer {
122122
return NewColorable(os.Stdout)
123123
}
124124

125-
// NewColorableStderr returns new instance of Writer which handles escape sequence for stderr.
125+
// NewColorableStderr returns new instance of writer which handles escape sequence for stderr.
126126
func NewColorableStderr() io.Writer {
127127
return NewColorable(os.Stderr)
128128
}
@@ -434,7 +434,7 @@ func atoiWithDefault(s string, def int) (int, error) {
434434
}
435435

436436
// Write writes data on console
437-
func (w *Writer) Write(data []byte) (n int, err error) {
437+
func (w *writer) Write(data []byte) (n int, err error) {
438438
w.mutex.Lock()
439439
defer w.mutex.Unlock()
440440
var csbi consoleScreenBufferInfo

0 commit comments

Comments
 (0)