Skip to content

Commit

Permalink
Merge: Refactor Metadata to use composition instead of embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrudolph committed Feb 12, 2021
2 parents 5f83f0d + 62b9289 commit dc8e1dc
Show file tree
Hide file tree
Showing 6 changed files with 711 additions and 669 deletions.
4 changes: 3 additions & 1 deletion cmd/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ type credentials struct {
SecretAccessKey string
}

// A log object can be passed around for use as a logger. It stores logs
// in memory and can flush the logs to a string when requested.
type log struct {
entries []string
}

func (l *log) Printf(format string, v ...interface{}) {
l.entries = append(l.entries, fmt.Sprintf(format, v...))
fmt.Printf(format, v...)
}

// Text returns a string concatenation of all of the log's entries.
func (l *log) Text() string {
return strings.Join(l.entries, "\n")
}
Expand Down
6 changes: 6 additions & 0 deletions metadata/logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package metadata

// A Logger represents a mechanism for logging. 🙃
type Logger interface {
Printf(format string, v ...interface{})
}
Loading

0 comments on commit dc8e1dc

Please sign in to comment.