diff --git a/web-service-gin/main.go b/web-service-gin/main.go index 861748b9384ee1a799d11a414ecae4252b304ef1..cee056b336f3a02550e8ee98d1ca3d20bce635a5 100644 --- a/web-service-gin/main.go +++ b/web-service-gin/main.go @@ -14,7 +14,6 @@ import ( var arrFile []string var idServ string -var port string var parent int var msgId = 0 var err error @@ -41,12 +40,13 @@ var albums = []album{ func initReq(c *gin.Context) { msgId = rand.Intn(100) parent = -1 + foundRsc = false printErr(err) + + fmt.Println("\n Start of new research ") for _, x := range arrFile { if x == c.Param("ressource") { - if !foundRsc { - fmt.Println("Ressource exist in Client") - } + fmt.Println("\n Ressource exist in Client ") foundRsc = true break } @@ -110,7 +110,7 @@ func foundReq(c *gin.Context) { printErr(err) portFinder := strconv.Itoa(basePort + finderNb) if parent == -1 { - fmt.Println("Instance of " + c.Param("ressource") + " found in " + portFinder) + fmt.Println("\n Instance of " + c.Param("ressource") + " found in " + portFinder) } else { sendFound(c.Param("ressource"), c.Param("finder")) } @@ -139,7 +139,6 @@ func main() { for _, file := range files { arrFile = append(arrFile, file.Name()) } - port = strconv.Itoa(basePort + nbIdServ) router := gin.Default() router.GET("/initReq/:tlv/:ressource", initReq) @@ -153,5 +152,5 @@ func main() { printErr(err) fmt.Println(body) */ - router.Run("localhost:" + port) + router.Run("localhost:" + strconv.Itoa(basePort+nbIdServ)) }