diff --git a/models/secret.go b/models/secret.go index 77fdb6e..ab8c6e7 100644 --- a/models/secret.go +++ b/models/secret.go @@ -173,13 +173,11 @@ func SecretsGetAllowed(s *Secret, userId int) ([]UserSecret, error) { // work around to get the UserId populated in the User field of the struct r.User.UserId = r.UserUserId - /* - // For debugging purposes - debugPrint := utils.PrintStructContents(&r, 0) - log.Println(debugPrint) + // For debugging purposes + debugPrint := utils.PrintStructContents(&r, 0) + log.Println(debugPrint) - log.Printf("SecretsGetAllowed performed debug print\n") - */ + log.Printf("SecretsGetAllowed performed debug print\n") // Append the secrets to the query output, don't decrypt the secrets (we didn't SELECT them anyway) //secretResults = append(secretResults, r) diff --git a/utils/structOperations.go b/utils/structOperations.go index bed0a26..53bb4c5 100644 --- a/utils/structOperations.go +++ b/utils/structOperations.go @@ -2,6 +2,7 @@ package utils import ( "fmt" + "log" "reflect" "strings" ) @@ -21,6 +22,8 @@ func PrintStructContents(s interface{}, indentLevel int) string { field := val.Field(i) fieldType := typ.Field(i) + log.Printf("PrintStructContents field '%s' (%T)\n", field, fieldType) + indent := strings.Repeat("\t", indentLevel) result.WriteString(fmt.Sprintf("%s%s: ", indent, fieldType.Name)) @@ -29,6 +32,7 @@ func PrintStructContents(s interface{}, indentLevel int) string { result.WriteString("\n") result.WriteString(PrintStructContents(field.Interface(), indentLevel+1)) default: + log.Printf("%v\n", field.Interface()) result.WriteString(fmt.Sprintf("%v\n", field.Interface())) } }