Last active
May 7, 2022 15:43
-
-
Save nomkhonwaan/77343c2072377527863105e2016a499e to your computer and use it in GitHub Desktop.
go-solid-interface-segregation-5dfc2eada33fd7a8f2eebc5c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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