Rename function for clarity
This commit is contained in:
parent
9558efc955
commit
35eef25f4a
|
@ -127,7 +127,7 @@ func Main (argStateDir string, processCallback ctwatch.ProcessCallback) {
|
||||||
os.Exit(3)
|
os.Exit(3)
|
||||||
}
|
}
|
||||||
stateFilename := filepath.Join(stateDir, "sths", defangLogUri(logUri))
|
stateFilename := filepath.Join(stateDir, "sths", defangLogUri(logUri))
|
||||||
prevSTH, err := ctwatch.ReadStateFile(stateFilename)
|
prevSTH, err := ctwatch.ReadSTHFile(stateFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%s: Error reading state file: %s: %s\n", os.Args[0], stateFilename, err)
|
fmt.Fprintf(os.Stderr, "%s: Error reading state file: %s: %s\n", os.Args[0], stateFilename, err)
|
||||||
os.Exit(3)
|
os.Exit(3)
|
||||||
|
@ -192,7 +192,7 @@ func Main (argStateDir string, processCallback ctwatch.ProcessCallback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctwatch.WriteStateFile(stateFilename, latestSTH); err != nil {
|
if err := ctwatch.WriteSTHFile(stateFilename, latestSTH); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "%s: Error writing state file: %s: %s\n", os.Args[0], stateFilename, err)
|
fmt.Fprintf(os.Stderr, "%s: Error writing state file: %s: %s\n", os.Args[0], stateFilename, err)
|
||||||
os.Exit(3)
|
os.Exit(3)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import (
|
||||||
"github.com/google/certificate-transparency/go/x509/pkix"
|
"github.com/google/certificate-transparency/go/x509/pkix"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ReadStateFile (path string) (*ct.SignedTreeHead, error) {
|
func ReadSTHFile (path string) (*ct.SignedTreeHead, error) {
|
||||||
content, err := ioutil.ReadFile(path)
|
content, err := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
@ -39,7 +39,7 @@ func ReadStateFile (path string) (*ct.SignedTreeHead, error) {
|
||||||
return &sth, nil
|
return &sth, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func WriteStateFile (path string, sth *ct.SignedTreeHead) error {
|
func WriteSTHFile (path string, sth *ct.SignedTreeHead) error {
|
||||||
sthJson, err := json.MarshalIndent(sth, "", "\t")
|
sthJson, err := json.MarshalIndent(sth, "", "\t")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue