Fix PIS inefficiencies and save output to file for debug purposes
All checks were successful
Go Test / test (push) Successful in 1m5s
All checks were successful
Go Test / test (push) Successful in 1m5s
This commit is contained in:
parent
0b3c1b6ad3
commit
5f57e1d267
@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
// Version Constants
|
||||
const versionNum string = "2024.11.1"
|
||||
const versionNum string = "2024.11.2"
|
||||
const versionSuffix string = ""
|
||||
const Version string = versionNum + versionSuffix
|
||||
|
||||
|
@ -3,6 +3,7 @@ package pis
|
||||
import (
|
||||
"archive/tar"
|
||||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@ -52,7 +53,7 @@ func runUpdate(tarballUrl string) error {
|
||||
}
|
||||
log.Info("Loaded PIS Files to Slice")
|
||||
|
||||
fmt.Println(&pisSlice)
|
||||
DEBUG_saveSliceToFile(*pisSlice, "pis_out.json")
|
||||
/*
|
||||
err = dbAccess.DropCollection(dbAccess.PisCollection)
|
||||
if err != nil {
|
||||
@ -197,3 +198,24 @@ func cleanupFiles(paths ...string) {
|
||||
}
|
||||
log.Info("Removed PIS Release files")
|
||||
}
|
||||
|
||||
// Saves pisSlice to file
|
||||
func DEBUG_saveSliceToFile(pisSlice interface{}, filename string) error {
|
||||
data, err := json.MarshalIndent(pisSlice, "", " ")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error marshalling slice to JSON: %v", err)
|
||||
}
|
||||
|
||||
file, err := os.Create(filename)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating file: %v", err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
_, err = file.Write(data)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error writing JSON to file: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user