From b397d3407d40164719ba773eda2ceda8b4dfc6cd Mon Sep 17 00:00:00 2001 From: Zach Loafman Date: Thu, 3 Nov 2022 15:51:53 -0700 Subject: [PATCH] Fix (not really) problems reported by VSCode (#2790) VSCode reports `main redeclared` between allocationload.go and runscenario.go due to the fact that they both look like `package main` binaries in the same directory, similar e.g. [this poster on a different project](https://stackoverflow.com/questions/66970531/vs-code-go-main-redeclared-in-this-block) To fix it, it's easy enough to just give these binaries their own package path and fix up the calling scripts. Along the way, fix a lint complaint in runscenario.go --- test/load/allocation/{ => allocationload}/allocationload.go | 0 test/load/allocation/runAllocation.sh | 2 +- test/load/allocation/runScenario.sh | 2 +- test/load/allocation/{ => runscenario}/runscenario.go | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename test/load/allocation/{ => allocationload}/allocationload.go (100%) rename test/load/allocation/{ => runscenario}/runscenario.go (99%) diff --git a/test/load/allocation/allocationload.go b/test/load/allocation/allocationload/allocationload.go similarity index 100% rename from test/load/allocation/allocationload.go rename to test/load/allocation/allocationload/allocationload.go diff --git a/test/load/allocation/runAllocation.sh b/test/load/allocation/runAllocation.sh index 376cbee4cb..343fce541d 100755 --- a/test/load/allocation/runAllocation.sh +++ b/test/load/allocation/runAllocation.sh @@ -31,7 +31,7 @@ counter=1 while [ $counter -le $TESTRUNSCOUNT ] do echo "Run number: " $counter - go run allocationload.go --ip ${EXTERNAL_IP} --port 443 --namespace ${NAMESPACE} --key ${KEY_FILE} --cert ${CERT_FILE} --cacert ${TLS_CA_FILE} --numberofclients $1 --perclientallocations $2 2>>./allocation_test_results.txt + go run allocationload/allocationload.go --ip ${EXTERNAL_IP} --port 443 --namespace ${NAMESPACE} --key ${KEY_FILE} --cert ${CERT_FILE} --cacert ${TLS_CA_FILE} --numberofclients $1 --perclientallocations $2 2>>./allocation_test_results.txt sleep 1200 ((counter++)) done diff --git a/test/load/allocation/runScenario.sh b/test/load/allocation/runScenario.sh index b22fade570..629a2b8f3c 100755 --- a/test/load/allocation/runScenario.sh +++ b/test/load/allocation/runScenario.sh @@ -31,6 +31,6 @@ CERT_FILE=${CERT_FILE:-client.crt} TLS_CA_FILE=${TLS_CA_FILE:-ca.crt} MULTICLUSTER=${MULTICLUSTER:-false} -go run runscenario.go --ip ${EXTERNAL_IP} --namespace ${NAMESPACE} \ +go run runscenario/runscenario.go --ip ${EXTERNAL_IP} --namespace ${NAMESPACE} \ --key ${KEY_FILE} --cert ${CERT_FILE} --cacert ${TLS_CA_FILE} \ --scenariosFile ${1} diff --git a/test/load/allocation/runscenario.go b/test/load/allocation/runscenario/runscenario.go similarity index 99% rename from test/load/allocation/runscenario.go rename to test/load/allocation/runscenario/runscenario.go index 91133116f7..b3fad70aec 100644 --- a/test/load/allocation/runscenario.go +++ b/test/load/allocation/runscenario/runscenario.go @@ -212,7 +212,7 @@ func readScenarios(file string) *[]scenario { if err != nil { logger.Fatalf("Failed opening the scenario file %s: %v", file, err) } - defer fp.Close() + defer func() { _ = fp.Close() }() var scenarios []scenario