MCPcopy Create free account
hub / github.com/derekbanas/Go-Tutorial / Account

Struct Account

hellogo.go:245–248  ·  view source on GitHub ↗

----- BANK ACCOUNT EXAMPLE ----- Here I'll simulate customers accessing a bank account and lock out customers to allow for individual access

Source from the content-addressed store, hash-verified

243// bank account and lock out customers to
244// allow for individual access
245type Account struct {
246 balance int
247 lock sync.Mutex // Mutual exclusion
248}
249
250func (a *Account) GetBalance() int {
251 a.lock.Lock()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected