Skip to content

Instantly share code, notes, and snippets.

@arriqaaq
Created January 26, 2023 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arriqaaq/994166dd0d36d5d208d93e5bc877cd9f to your computer and use it in GitHub Desktop.
Save arriqaaq/994166dd0d36d5d208d93e5bc877cd9f to your computer and use it in GitHub Desktop.
type Database struct {
// fields and methods
}
var db *Database
func GetDatabase() *Database {
if db == nil {
db = &Database{}
}
return db
}
func ProcessData() {
// Tightly coupled code
GetDatabase().SaveData("data")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment