mirror of
https://github.com/foomo/contentserver.git
synced 2025-10-16 12:25:44 +00:00
repo history code cleanup
This commit is contained in:
parent
65b6b2341a
commit
03d5b36706
@ -28,18 +28,21 @@ func newHistory(varDir string) *history {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *history) add(jsonBytes []byte) error {
|
func (h *history) add(jsonBytes []byte) error {
|
||||||
// historic file name
|
|
||||||
filename := path.Join(h.varDir, historyRepoJSONPrefix+time.Now().Format(time.RFC3339Nano)+historyRepoJSONSuffix)
|
var (
|
||||||
err := ioutil.WriteFile(filename, jsonBytes, 0644)
|
// historiy file name
|
||||||
|
filename = path.Join(h.varDir, historyRepoJSONPrefix+time.Now().Format(time.RFC3339Nano)+historyRepoJSONSuffix)
|
||||||
|
err = ioutil.WriteFile(filename, jsonBytes, 0644)
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// current filename
|
// current filename
|
||||||
return ioutil.WriteFile(h.getCurrentFilename(), jsonBytes, 0644)
|
return ioutil.WriteFile(h.getCurrentFilename(), jsonBytes, 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *history) getHistory() (files []string, err error) {
|
func (h *history) getHistory() (files []string, err error) {
|
||||||
files = []string{}
|
|
||||||
fileInfos, err := ioutil.ReadDir(h.varDir)
|
fileInfos, err := ioutil.ReadDir(h.varDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user