summary refs log tree commit diff stats
path: root/cmd
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-03-25 23:32:05 +0530
committerAndinus <andinus@nand.sh>2020-03-25 23:32:05 +0530
commit57fb2b88ba050e4c376fdbe1d9eca83966e0c4a4 (patch)
tree2702cd79e2294a562bba754bf77340bc862bc479 /cmd
parent370a9f224e9fa892e89bdfe5d179d5d0d33b8911 (diff)
downloadcetus-57fb2b88ba050e4c376fdbe1d9eca83966e0c4a4.tar.gz
Disable cache when random is not passed (bpod)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cetus/bpod.go27
1 files changed, 19 insertions, 8 deletions
diff --git a/cmd/cetus/bpod.go b/cmd/cetus/bpod.go
index 1543cb1..e2bb8e2 100644
--- a/cmd/cetus/bpod.go
+++ b/cmd/cetus/bpod.go
@@ -219,16 +219,27 @@ func dlAndCacheBPODBody() {
 		log.Fatal(err)
 	}
 
-	// Write body to the cache so that it can be read later.
-	err = ioutil.WriteFile(file, []byte(body), 0644)
+	// Write body to the cache so that it can be read later. This
+	// will mess up the cache because the cache format will be
+	// inconsistent, res is not the same as body and they should
+	// be in sync before saving body to cache but here we don't
+	// yet have res. This issue arises when the user passes random
+	// flag, we are saving to cache the raw body returned but when
+	// random is passed the format of body is changed to only
+	// values unmarshalled in res because body is rebuilt from res
+	// so the cache will have different format of body. Disabling
+	// this cache for now seems like a good option, later we can
+	// figure out how to make this body and body when random is
+	// passed of same format.
+	// err = ioutil.WriteFile(file, []byte(body), 0644)
 
 	// Not being able to write to the cache file is a small error
 	// and the program shouldn't exit but should continue after
 	// printing the log so that the user can investigate it later.
-	if err != nil {
-		err = fmt.Errorf("%s\n%s",
-			"bpod.go: failed to write body to file: ", file,
-			err.Error())
-		log.Println(err)
-	}
+	// if err != nil {
+	// 	err = fmt.Errorf("%s\n%s",
+	// 		"bpod.go: failed to write body to file: ", file,
+	// 		err.Error())
+	// 	log.Println(err)
+	// }
 }