From 0d2fe61af698a0e1d1f650d80f296bd88fc3cb6e Mon Sep 17 00:00:00 2001 From: Emile Date: Wed, 9 Oct 2019 18:34:23 +0200 Subject: gofmt and added user to stats struct --- src/seed.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/seed.go') diff --git a/src/seed.go b/src/seed.go index dd836ff..805ab20 100644 --- a/src/seed.go +++ b/src/seed.go @@ -4,15 +4,17 @@ import ( "encoding/json" "flag" "fmt" - "github.com/pkg/errors" "io/ioutil" "log" "time" + + "github.com/pkg/errors" ) var ( - challenges = []Challenge{} - seedFilePath* string + challenges = []Challenge{} + seedFilePath *string + user string ) func registerSeedFlags() { @@ -52,13 +54,13 @@ func readSeedFile(path string) ([]Challenge, error) { if nameOK && descOK && flagOK && contOK && categoryOK { tmpChallenges = append(tmpChallenges, Challenge{ - Name: name, + Name: name, Description: desc, - Flag: flag, - FoundFlag: time.Unix(0, 0), - FlagTries: 0, - Container: cont, - Category: category, + Flag: flag, + FoundFlag: time.Unix(0, 0), + FlagTries: 0, + Container: cont, + Category: category, }) } else { log.Printf("Ignoring challenge at position %d: Not all values are parseable (name: %b, desc: %b, flag: %b, container: %b, category: %b", index, nameOK, descOK, flagOK, contOK, categoryOK) @@ -69,7 +71,7 @@ func readSeedFile(path string) ([]Challenge, error) { } // Read the file we set up using flags and store the returned challenge array -func getChallengesFromSeedFile() (error) { +func getChallengesFromSeedFile() error { tmpChallenges, error := readSeedFile(*seedFilePath) if error != nil { @@ -124,6 +126,7 @@ func generateJSONFromChallengesForStats() (string, error) { } marshalled, marshalError := json.Marshal(map[string]interface{}{ + "user": user, "challenges": strippedChallenges, }) return string(marshalled), marshalError -- cgit 1.4.1