is actually learning to write a background service in GO recently.
want to rewrite a previous service,
an object is new when a previous request comes in. Then manipulate the object.
within the class, member variables can be defined and shared by all member functions. There are some functions that share these variables.
but when refactoring with GO, because GO has no concept of classes, it feels like something is missing.
define a global variable that will be shared by all requests (not a request to generate a new variable).
do not define global variables, many functions use the same thing, all functions need to constantly return parameters for the next function to use.
it"s always awkward to use structs to simulate classes. How can you modify it to make your code concise and efficient?
I do not know whether the description of the problem is clear or not, and I would like to ask all the bosses for advice.