Singleton in go

后端 未结 9 2108
心在旅途
心在旅途 2021-01-30 10:46

How does one implement the Singleton design pattern in the go programming language?

9条回答
  •  無奈伤痛
    2021-01-30 11:20

    Just put your variables and functions at the package level.

    Also see similar question: How to make a singleton in Python

提交回复
热议问题