Skip to content

Commit

Permalink
no-op
Browse files Browse the repository at this point in the history
  • Loading branch information
utahta committed Feb 8, 2017
1 parent 51485d0 commit c9076f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
6 changes: 0 additions & 6 deletions mutex.go

This file was deleted.

11 changes: 11 additions & 0 deletions noop.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package writer

type noopMutex struct{}
type noopWriter struct{}

func (*noopMutex) Lock() {}
func (*noopMutex) Unlock() {}

func (*noopWriter) Write([]byte) (int, error) {
return 0, nil // no-op
}
8 changes: 1 addition & 7 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ type CronoWriter struct {

type Option func(*CronoWriter)

type noopWriter struct{}

func (*noopWriter) Write([]byte) (int, error) {
return 0, nil // no-op
}

var (
_ io.WriteCloser = &CronoWriter{} // check if object implements interface
now func() time.Time = time.Now // for test
Expand All @@ -46,7 +40,7 @@ func New(pattern string, options ...Option) (*CronoWriter, error) {
path: "",
fp: nil,
loc: time.Local,
mux: new(NoMutex), // default mutex off
mux: new(noopMutex), // default mutex off
stdout: &noopWriter{},
stderr: &noopWriter{},
init: false,
Expand Down

0 comments on commit c9076f3

Please sign in to comment.