Skip to content

Instantly share code, notes, and snippets.

@nomkhonwaan
Last active May 7, 2022 15:43
Show Gist options
  • Save nomkhonwaan/77343c2072377527863105e2016a499e to your computer and use it in GitHub Desktop.
Save nomkhonwaan/77343c2072377527863105e2016a499e to your computer and use it in GitHub Desktop.
go-solid-interface-segregation-5dfc2eada33fd7a8f2eebc5c
// WriteLog writes change log data into the file.
// A successful writing will return nil.
// When unable to write, an error will be returned.
func WriteLog(f *os.File, c ChangeLog) error
// WriteLog writes change log data into the file.
// A successful writing will return nil.
// When unable to write, an error will be returned.
func WriteLog(f io.ReadWriteCloser, c ChangeLog) error
package main
import (
"io"
"os"
"path/filepath"
)
// WriteLog writes change log data into the file.
// A successful writing will return nil.
// When unable to write, an error will be returned.
func WriteLog(f io.Writer, c ChangeLog) error {
// TODO: Implement Me!
return nil
}
func main() {
f, err := os.Create(filepath.Join(os.TempDir(), "change.log"))
if err != nil {
panic(err)
}
defer f.Close()
c := ChangeLog{}
err = WriteLog(f, c)
if err != nil {
panic(err)
}
}
type ChangeLog struct{}
// WriteLog writes change log data into the file.
// A successful writing will return nil.
// When unable to write, an error will be returned.
func WriteLog(f io.WriteCloser, c ChangeLog) error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment