go: appease the linters

* also, build the correct pkg in pre-commit
This commit is contained in:
leo 2023-05-14 21:03:45 +02:00
parent 189ceb5181
commit 2dfdd86460
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ
2 changed files with 13 additions and 10 deletions

@ -46,9 +46,9 @@ repos:
pass_filenames: false
files: "flake.(nix|lock)$"
language: system
- id: nix-build-go-proj
name: nix build go proj
entry: nix build .#proj
- id: nix-build-go-ak0da
name: nix build go ak0da
entry: nix build .#ak0da
pass_filenames: false
# trigger this hook on changes to any of nix (also flake.lock) files
# and go's mod or sum files

17
main.go

@ -48,19 +48,20 @@ func main() {
}
}
fmt.Printf("\tAverage anomaly score for normal data: %f\n",
fmt.Fprintf(os.Stderr, "\tAverage anomaly score for normal data: %f\n",
avg/float64(randomDataSize),
)
fmt.Printf("\tMinimum anomaly score for normal data: %f\n",
fmt.Fprintf(os.Stderr, "\tMinimum anomaly score for normal data: %f\n",
minScore,
)
// these values should be much higher as comapred to the scores for normal
// data.
fmt.Println("\tAnomaly scores for outliers are:")
fmt.Fprintln(os.Stderr, "\tAnomaly scores for outliers are:")
for i := randomDataSize; i < (randomDataSize + outliers); i++ {
fmt.Print("\t")
fmt.Println(predictions[i])
fmt.Fprint(os.Stderr, "\t")
fmt.Fprintln(os.Stderr, predictions[i])
}
log.Println("we're done")
@ -97,10 +98,12 @@ func loadData() (*base.DenseInstances, error) {
// a file in CSV format.
func prepData(path string) error {
log.Println("generating data")
data := genData(true, randomDataSize, -1.0, 1.0)
log.Println("generating data - done")
data := genData(true, randomDataSize, -1.0, 1.0)
log.Println("generating data - done")
log.Printf("saving data to file at '%s'\n", path)
f, err := os.Create(path)
if err != nil {
log.Printf("could not save data to file at '%s'\n", path)