Is it recommended to use Global Variables in a program that implements Goroutines?

devquora
devquora

Posted On: Nov 08, 2022

 

You should not use global variables at all. Unless there is a solid reason for that. And you should not use goroutines just for the sake of it, even though go ones are quite cheap they can have side effects and complicate the program needlessly.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Go Programming Language

    What are Goroutines?

     Goroutines are the methods and functions that run concurrently with another methods or functions. Goroutines can be co..

    Go Programming Language

    What are channels in Go language and how can you use them?

    Go provides a mechanism, which is called channel that is utilized to share data between goroutines. When you execute a ..

    Go Programming Language

    How can you distribute tasks in Go to different machines?

    Following details is the way how we can distribute various tasks in Go to different machines: Get the Dependencies Writ..