?? ??? VictoriaMetrics ???? ???? ????: https://victoriametrics.com/blog/go-singleflight/
? ???? Go? ??? ??? ?? ???? ?????.
- ???.Mutex: ?? ? ?? ??
- ???.WaitGroup ? ?? ??
- Sync.Pool? ? ?? ?? ????
- ?? ???? ??? ????, go sync.Cond
- Go sync.Map: ??? ??? ?? ??? ??
- Go Sync.Once? ?????... ?? ?????
- Go Singleflight? DB? ?? ??? ?? ????(?? ??)
??? ??? ???? ???? ?? ??? ??? ???? ?? ?? ??? ? ??? ??? ??? ?? ?? ????? ??????? ???? ????. . ??? ???? ?? ?? ??? ??? ?? ? ???? ??? ???, ??? ??? ?? ???????.
?? ??????? ???? ??? ???? ?? ?? ??? ? ??? ?? ??? ? ?? ??? ????.
? ?? ??? ??? ??????? ????? ?????. ??? ??? ? ?? ??? ??? ??? ?????. ?? ???? ???? ???? ?? ??? ??? ??? ????. ?? ??? ???? ????.
?? ? ???? ??? ?? ??? ? ? ????
?? ??
Go? Singleflight ???? ?? ???? ??? ???? ???? ?? ??? ???????. ??? ?? ??????, ?? ?????? ??? ???? Go ??? ?? ???? ?????.
singleflight? ?? ?? ???????? ???? ???? ?? ?? ??? ? ??? ??? ??? ????? ?? ????. ?? ??? ??? ??? ??("?"?? ?)? ?? ? ? ?? "?? ?"(?? ??) ??? ?????.
??? ?? ??? ?? ???? ?? ?? ???? ??? ???(??? ?)? ???? ???? ???. ?? ?? ? ?? ??? ???? ??? ?? ??? ?? ?? ?? ?? ??? ??? ??? ????.
?, ???? ?? ??, ??????? ??? ??? ????? ???? ?? ??? ??? ???????.
var callCount atomic.Int32 var wg sync.WaitGroup // Simulate a function that fetches data from a database func fetchData() (interface{}, error) { callCount.Add(1) time.Sleep(100 * time.Millisecond) return rand.Intn(100), nil } // Wrap the fetchData function with singleflight func fetchDataWrapper(g *singleflight.Group, id int) error { defer wg.Done() time.Sleep(time.Duration(id) * 40 * time.Millisecond) v, err, shared := g.Do("key-fetch-data", fetchData) if err != nil { return err } fmt.Printf("Goroutine %d: result: %v, shared: %v\n", id, v, shared) return nil } func main() { var g singleflight.Group // 5 goroutines to fetch the same data const numGoroutines = 5 wg.Add(numGoroutines) for i := 0; i < numGoroutines; i++ { go fetchDataWrapper(&g, i) } wg.Wait() fmt.Printf("Function was called %d times\n", callCount.Load()) } // Output: // Goroutine 0: result: 90, shared: true // Goroutine 2: result: 90, shared: true // Goroutine 1: result: 90, shared: true // Goroutine 3: result: 13, shared: true // Goroutine 4: result: 13, shared: true // Function was called 2 times
?? ??:
??? 5?? ???? 60ms ???? ?? ??? ??? ???? ????? ???? ??? ??????? ????. ???? ???? ?? ??? ???? ???????? ??? ???? ?????.
singleflight.Group? ???? ? ?? ???? ??? fetchData()? ???? ???? ??? ?????.
v, err, shared := g.Do("key-fetch-data", fetchData) ?? ??? ??? ???? ?? ?? ?("key-fetch-data")? ?????. ??? ? ?? ???? ??? ???? ???? ?? ?? ???? ??? ?? ???? ? ??? ???? ?? ??? ?????.
? ?? ??? ??? ???? ??? ? ??? ?? ?? ?? ???? ??? ??? ????. ???? ???? ???? 5? ???? fetchData? ? ?? ??????, ?? ??? ?? ?????.
?? ???? ??? ?? ????? ??????? ?????.
"?? ??? ? ?? ?????? ?? ???? true???? ?? ?? ??? ?? == true? ??? ??????"
?, ?? ?? ???? == true? ???? ??? ????? ?? ?? ??? ????? ??? ? ????.
??? ?? g.Do? ?? ??? ??? ?? ??? ?? ?????? ??? ????? ????. ????? "? ??? ? ? ??? ???? ??????."?? ????. ?? ??? ?????? ??? ??? ?? ????? ??????? ??? ????.
"??? ??? ? ??????? ??????"
?? ??? ??? ????. ??? ?? ??? ?? ?? ??? ???? ??? ?? ? ?????.
?? ??(?: Redis ?? Memcached)? ???? ???? Singleflight? ???????? ??? ?? ???? ?? ?? ??? ?????.
?? Singleflight? ?? ?? ??("?? ????"??? ?)???? ???? ? ??? ???.
????? ???? ???? ??? ? ???? ??? ??? ????. ?? ?? ?????. ???? ??? ??? ?? ?????. ??? ????? ?? 10,000?? ??? ??? ???? ????? ???? ??????? ??? 10,000?? ??? ??? ??? ??? ? ????.
? ?? ?? ?? Singleflight? 10,000?? ?? ? ??? ??? ??????? ????? ?????.
??? ??? ?? ?? ????? ?? ??? ?? ???? ?? ?? ?? ??? ? ? ?? ?? ? ??? ??? ???? ?? ?? ??? ???? ?? ? ? ????. ?? ?? ???? ???? ?? ?? ??? ??? ? ????.
?? ??? ?? CPU? ?? ???? ? ? ??? ? ????.
? ????? ?? ??? ??? ???? ?? ??? ?????.
?? ?? ??
singleflight? ????? ?? ?? ?? ??? ???? ?? ??? ???? ?? ??? ?? ??? ????.
?? ??? ???? ? ??? ?? ? ?? ?? ??? ????.
- group.Do(key, func): ?? ??? ????? ??? ?????. Do? ???? ?? ??? ???? ?? ?? ?? ?? ??? ???? ??? ??? ?????. ??? ?? ?? ?? ??? ?? ?? ?? ? ?? ??? ??? ??? ??? ???? ??? ??? ?????.
- group.DoChan(key, func): group.Do? ????? ???? ?? ??(<-chan ??)? ?????. ??? ???? ?? ??? ??? ?????? ???? ?? ????? ?? ??? ???? ?? ?????.
??? ?? ???? g.Do()? ???? ??? ???????. ??? ?? ??? g.DoChan()? ???? ??? ??? ?????.
var callCount atomic.Int32 var wg sync.WaitGroup // Simulate a function that fetches data from a database func fetchData() (interface{}, error) { callCount.Add(1) time.Sleep(100 * time.Millisecond) return rand.Intn(100), nil } // Wrap the fetchData function with singleflight func fetchDataWrapper(g *singleflight.Group, id int) error { defer wg.Done() time.Sleep(time.Duration(id) * 40 * time.Millisecond) v, err, shared := g.Do("key-fetch-data", fetchData) if err != nil { return err } fmt.Printf("Goroutine %d: result: %v, shared: %v\n", id, v, shared) return nil } func main() { var g singleflight.Group // 5 goroutines to fetch the same data const numGoroutines = 5 wg.Add(numGoroutines) for i := 0; i < numGoroutines; i++ { go fetchDataWrapper(&g, i) } wg.Wait() fmt.Printf("Function was called %d times\n", callCount.Load()) } // Output: // Goroutine 0: result: 90, shared: true // Goroutine 2: result: 90, shared: true // Goroutine 1: result: 90, shared: true // Goroutine 3: result: 13, shared: true // Goroutine 4: result: 13, shared: true // Function was called 2 times
// Wrap the fetchData function with singleflight using DoChan func fetchDataWrapper(g *singleflight.Group, id int) error { defer wg.Done() ch := g.DoChan("key-fetch-data", fetchData) res := <-ch if res.Err != nil { return res.Err } fmt.Printf("Goroutine %d: result: %v, shared: %v\n", id, res.Val, res.Shared) return nil }
??? ??? DoChan()? ???? ?? Do()? ?? ?? ??? ????. ????? ??? ??? ???? ?? ?? ??(<-ch)?? ??? ???? ?? ?????. ?????.
DoChan()? ?? ??? ?? ???? ???? ?? ??? ???? ?? ??? ????? ?????. ?? ?? ??? ???? ?? ??? ??? ? ???? ??? ? ????.
package singleflight type Result struct { Val interface{} Err error Shared bool }
? ???? ?? ?????? ??? ? ?? ? ?? ??? ?????.
- ? ?? ???? ?? ???? ??, ???? ?? ?????? ??? ?? ???? ?? ?? ? ????. ? ?? ?? ?? ?? ?? ???? ??? ??? ?? ????. ???? ?? ??? ??? ? ? ??? ??? ??? ??? ??? ?? ?? ??? ???? ???.
- ???? ???? ?? ??? ? ???? ? ?? ??? ??? ???? ??? ????? ? ????. ?? ?? ????? ??? ??? ????? ??? ????? ?? ?????.
?, Singleflight? ?? ?? ??? ??? ? ?? group.Forget(key) ???? ???? ??? ??? ???? ??? ?????.
Forget() ???? ?? ?? ?? ??? ???? ?? ??? ?? ?????. ?? ?? "???"?? ?? ????? ?? ?? g.Do()? ?? ???? ?? ??? ??? ??? ???? ?? ?? ??? ??? ??? ??? ?????.
Forget()? ????? ??? ?????? ??? ??? ? ? ????? ???????.
var callCount atomic.Int32 var wg sync.WaitGroup // Simulate a function that fetches data from a database func fetchData() (interface{}, error) { callCount.Add(1) time.Sleep(100 * time.Millisecond) return rand.Intn(100), nil } // Wrap the fetchData function with singleflight func fetchDataWrapper(g *singleflight.Group, id int) error { defer wg.Done() time.Sleep(time.Duration(id) * 40 * time.Millisecond) v, err, shared := g.Do("key-fetch-data", fetchData) if err != nil { return err } fmt.Printf("Goroutine %d: result: %v, shared: %v\n", id, v, shared) return nil } func main() { var g singleflight.Group // 5 goroutines to fetch the same data const numGoroutines = 5 wg.Add(numGoroutines) for i := 0; i < numGoroutines; i++ { go fetchDataWrapper(&g, i) } wg.Wait() fmt.Printf("Function was called %d times\n", callCount.Load()) } // Output: // Goroutine 0: result: 90, shared: true // Goroutine 2: result: 90, shared: true // Goroutine 1: result: 90, shared: true // Goroutine 3: result: 13, shared: true // Goroutine 4: result: 13, shared: true // Function was called 2 times
Goroutine 0? Goroutine 1? ?? ??? ?("key-fetch-data")? ???? Do()? ???? ?? ??? ??? ???? ???? ??? ? goroutine ?? ?????.
??? Goroutine 2? Do()? ???? ?? Forget()? ?????. ??? ?? "key-fetch-data"? ??? ?? ??? ?? ???? ??? ??? ??? ?????.
?????, ?? ????(singleflight)? ????? ??? ??? ?? ?? ???? ??? ?? ? ????.
- ? ?? ???? ?? ???? ???? ?? ???? ?? ?? ?? ???? ?????. ??? ???? ?? ?? ????? ?? ??? ?? select ?? ???? ?? ? ?? ??? ? ? ????.
- ? ?? ???? ??? ??? ???? ??? ??? ??? ??? ???? ?? ?? ???? ?????.
??? ??? ?? ??? ????? ?? ???? ???? ??? ?? ??? ????? ??? ????? ??? ?????.
?? ?? ?? ??
singleflight? ???? ????? ??? ?????? ?? ?? ????? ?? ?? ?? ? ???, Singleflight? ?? ??? ? 150?? ??? ?????.
????? ?? ?? ?? ??? ???? ???? ????. ???? Do()? ???? ?? ?? ????? ?? ???? ? ?? ??? ??? ??? ?? ??? ???? ??? ??? ????.
// Wrap the fetchData function with singleflight using DoChan func fetchDataWrapper(g *singleflight.Group, id int) error { defer wg.Done() ch := g.DoChan("key-fetch-data", fetchData) res := <-ch if res.Err != nil { return res.Err } fmt.Printf("Goroutine %d: result: %v, shared: %v\n", id, res.Val, res.Shared) return nil }
????? ? ?? ??? ?? ??? ?????.
- ?? ???(g.mu): ? ???? ?? ??? ??? ?? ?? ? ?? ???? ? ?? ?? ??? ?????? ???? ?????.
- WaitGroup(g.call.wg): WaitGroup? ?? ?? ??? ? ?? ???? ??? ??? ??? ???? ? ?????.
????? group.Do() ???? ??? ?????. ?? ???? group.DoChan()? ??? ???? ???? ?????. group.Forget() ???? ??? ?? ???? ??? ?????.
group.Do()? ???? ?? ?? ?? ?? ?? ?? ?(g.mu)? ??? ????.
"??? ????? ??? ???"
?, ?? ??? ?? ?? ??? ??? ?? ??? ??? ?????? ?? ? ????(?? ?? ?????? ?? ????). ? ?? ??? ??? ??? ???? ???? ?? ?? ????? ???? ?? ?? ?? ?????. ??? ?? ?? ??? ???? ?? "?? ??"? ???? ?? ?? ?? ??? ??? ??? ? ????
??? shardedsingleflight ???? ?????.
?? ??? ???? ?? ?? ?? ?? ?? ???? ??? ??? ?? ?? ??? ?? ??(g.m)? ?????. ? ??? ?? ??? ??? ?? ???? ?? ???? ??? ??? ?????.
?? ????(?? ???? ?? ??? ?? ??) ? ??? ???? ?? ??? ???(c.dups)? ???? ?? ??? ?????. ?? ?? ???? ??? ???? ??? WaitGroup?? call.wg.Wait()? ???? ?? ??? ??? ??? ?????.
?? ??? ???? ? ???? ??? ???? ?? ?? ??? ?????.
var callCount atomic.Int32 var wg sync.WaitGroup // Simulate a function that fetches data from a database func fetchData() (interface{}, error) { callCount.Add(1) time.Sleep(100 * time.Millisecond) return rand.Intn(100), nil } // Wrap the fetchData function with singleflight func fetchDataWrapper(g *singleflight.Group, id int) error { defer wg.Done() time.Sleep(time.Duration(id) * 40 * time.Millisecond) v, err, shared := g.Do("key-fetch-data", fetchData) if err != nil { return err } fmt.Printf("Goroutine %d: result: %v, shared: %v\n", id, v, shared) return nil } func main() { var g singleflight.Group // 5 goroutines to fetch the same data const numGoroutines = 5 wg.Add(numGoroutines) for i := 0; i < numGoroutines; i++ { go fetchDataWrapper(&g, i) } wg.Wait() fmt.Printf("Function was called %d times\n", callCount.Load()) } // Output: // Goroutine 0: result: 90, shared: true // Goroutine 2: result: 90, shared: true // Goroutine 1: result: 90, shared: true // Goroutine 3: result: 13, shared: true // Goroutine 4: result: 13, shared: true // Function was called 2 times
?? ?? ?? ?? ???? ???? ?? ?? ?? ???? ?? ??? ?????.
? ????? ? ?? ??? ???? ?? ???? ?? WaitGroup? ??????. ?? ?? ???? ?? ???? ??? ??? g.doCall(c, key, fn)? ?? ?? ?? ??? ?????. ??? ???? wg.Wait() ??? ?? ?? ?? ?? ???? ?? ?????.
??? ???? ??? ???? ??? ?? ? ?? ????? ????.
- ?? ??? ???? ?? ???? ?? ??? ???? ??? ??????.
- ??? errGoexit? ???? ??, Runtime.Goexit()? ???? ???? ???? ?????.
- ???? ??? ?? ?? ? ?? ??? ?????.
??? ??? ??? g.doCall()? ? ? ????? ?????.
"??, ???.Goexit()? ???"
??? ???? ?? ??? ?????, Runtime.Goexit()? ??? ??? ???? ? ?????.
???? Goexit()? ???? ???? ??? ?? ??? ??? ????? ????(LIFO) ??? ?? ?????. ??? ????? ? ?? ???? ????.
- ??? ???? ????, Recover()? ?? ? ????.
- Goexit()? ???? ???? ???? ?? ?? ???? ?? ????? ?????.
??? ???? ??? ????(?? ??? ????? ??? ??? ??? ??? ??). ?? ???(main() ??? ??)?? Runtime.Goexit()? ???? ?? ??? ?????.
var callCount atomic.Int32 var wg sync.WaitGroup // Simulate a function that fetches data from a database func fetchData() (interface{}, error) { callCount.Add(1) time.Sleep(100 * time.Millisecond) return rand.Intn(100), nil } // Wrap the fetchData function with singleflight func fetchDataWrapper(g *singleflight.Group, id int) error { defer wg.Done() time.Sleep(time.Duration(id) * 40 * time.Millisecond) v, err, shared := g.Do("key-fetch-data", fetchData) if err != nil { return err } fmt.Printf("Goroutine %d: result: %v, shared: %v\n", id, v, shared) return nil } func main() { var g singleflight.Group // 5 goroutines to fetch the same data const numGoroutines = 5 wg.Add(numGoroutines) for i := 0; i < numGoroutines; i++ { go fetchDataWrapper(&g, i) } wg.Wait() fmt.Printf("Function was called %d times\n", callCount.Load()) } // Output: // Goroutine 0: result: 90, shared: true // Goroutine 2: result: 90, shared: true // Goroutine 1: result: 90, shared: true // Goroutine 3: result: 13, shared: true // Goroutine 4: result: 13, shared: true // Function was called 2 times
Goexit()? ?? ???? ????? ?? ???? ?? ?? ?? ?? ??? ??? ???? ????? ?? ? Go ???? ?? ??? ????? ????? ?? ?????. ??? ???? ??? ?? ??? "??? ??" ??? ???? ??? ?????. ?? ??? ???? ?? ??????.
?? ??? ????, Runtime.Goexit()? ?? ???? ???? Recover()? ?? ??? ? ?? ??, ?????? ??? ??????
??? Runtime.Goexit()? ??? ? ? ??? ?? ??? ???? ???? ??? ????.
// Wrap the fetchData function with singleflight using DoChan func fetchDataWrapper(g *singleflight.Group, id int) error { defer wg.Done() ch := g.DoChan("key-fetch-data", fetchData) res := <-ch if res.Err != nil { return res.Err } fmt.Printf("Goroutine %d: result: %v, shared: %v\n", id, res.Val, res.Shared) return nil }
?? ??, running.Goexit()? ??? ? NormalReturn = true ?? ???? ????. ??? defer ???? NormalReturn? ??? false?? ???? ?? ???? ?????? ??? ? ????.
?? ??? ??? ?? ???? ??? ???? ????. ?? ?? ?? ???? ??()? ?????, Singleflight? ?? ??? ? ? ?????.
package singleflight type Result struct { Val interface{} Err error Shared bool }
recover ?? ??? Recover = true? ?? ???? ??, Recover() ?? ??? Recovered? ??? ?? ???? ? ??? ?? ?????.
???? ??? ? ???? ????
runtime.Goexit()? ???? ??()? ????? ?? ???? ?????. ???panic()? ???? ?? ???? ??nic()? Recover() ??? ?? ??? ?????.
??? ?? = true? ??()? ???? defer ???? ???? ?????. ? ?? ???? ?????: ??? ????? ????? ??? ??? ?, ???.Goexit()? ??? ?? ???? ????.
??? ? ??? ??? ????? ????????.
func fetchDataWrapperWithTimeout(g *singleflight.Group, id int) error { defer wg.Done() ch := g.DoChan("key-fetch-data", fetchData) select { case res := <-ch: if res.Err != nil { return res.Err } fmt.Printf("Goroutine %d: result: %v, shared: %v\n", id, res.Val, res.Shared) case <-time.After(50 * time.Millisecond): return fmt.Errorf("timeout waiting for result") } return nil }
?? ?? ?? ??? ???? ??? ???? c.err? ?? ?? ?? ??? ?? ???? ?? ??? ?????. Singleflight? ??? ???? ???? ????? ?? ???? ?? ?? ??? ??? ? ??? ?? ??????.
?, ??? ???? ???(??? ??? ? ?? ???)?? ??? ???? ??? ???? ?? ?? ???? ?? ??? ??? ?????.
??? ??? ???? ???? ????? ???? ???? ?? ??? ????.
?? ???? ? ??? ??? ????. ?? ???? group.DoChan() ???? ???? ??? ?? ??? ???? ?????. ? ??, ?? ??? ?? ????? ??? ? ????. ?? ??? ? ?? ??(go ??(e))? ???? ??????? ?????.
?????, Runtime.Goexit()??? ??? ?? ?? ???? ?? ???? ???? ?? ??? ?? ??? ??? ???? ?? ????? ???? ?? ???.
?? ?????. ??? ??? ??? ??? ???? ??? ??? ?? ????.
?? ??
?????, ?? VictoriaMetrics? ????? ????? Phuong Le???. ?? ??? ???? ???? ???? ??? ?? ??? ???? ?? ???? ????? ???? ???? ?? ???? ??? ?????.
??? ??? ????? ??? ?? ??? ???? ?? ?????. X(@func25)? DM? ?????.
??? ??? ?? ?? ?? ???:
- Go I/O ??, ?? ? ?? ?? ???.
- Go ???? ?? ??? For-Range? ????
- Slices in Go: ???? ??? ?????
- Go Maps ??: ?-? ?? ??? ???? ??
- Golang Defer: ???? ????
- Vendoring ?? Go Mod Vendor:? ??????
??? ????
???? ?????? ??? ???? ?? ?? ??? ????? ????? VictoriaMetrics? ??? ???. ?? ???? ??? ? ?? ??? ?? ???? ??? ???? ?????.
??? Go? Go ???? ?? ??, ??, ?? ??? ???? Gophers???.
? ??? Go Singleflight? DB? ?? ???? ?????.? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











GO? ????? ????? ??? ????? ??????. ?? ??? ?? ?????. 1. ? ??? ?? : Linux ????? ?? ??? ?????? ??? ??? ? ????. 2. ?? ??? ??? ?? ???? ???? ?? ??? ????? ?? ??? ?? ?? ??? ?? ??? ? ? ????. 3. ?? ?? ???? ?? : ?? ????? ??? ??? ?? ??? ??? ???? ??????. 4. ??? ?? ??? : ??? ???? ????? ?? ?????? ? ???? ? ? ??? ??? ? ??? ?????. ??? ??? CLI ??, ???? ??? ? ?? ????? ????? ????? ????? ?? ??? ??? ???? ????? ???? ??? ?????.

goensuresmemorysafety? ?? MemolemanucameThrougatomaticgargarbagecollection, nopointerarithmetic, safeconcurrency, andruntimechecks.first, go'sgarbagecollectoricallyally reclaimsunusedmemory, ??, itdisallowspointe, itdisallowspointe ??

GO?? ?? ??? ???? MAKE ??? ?? ?? ?? ? ??????. ?? ??? ???? ??? ??? ???? ?? ? ???? ?? ? ?? ??? ???? ?? ? ???? ??? ??? ? ????. ?? ??, ch : = make (Chanint, 10)? ?? 10 ?? ?? ?? ??? ??? ?? ??? ????. ???? ?? ??? ??, ??? ???? ?? ???? ??? ???? ???? ?? ? ??? ??? ????? ?????. ??? ??? ?, ?? : 1. ?? ??? ??? ??? ?? ??? ??? ??? ?? ?????????. 2. ??? ??? ??? ??? ??? ???? ?? ???????. 3. ??? chanstruct {} ??? ?? ?? ? ? ????. ???? ?????? ??? ?, ??? ??? ?? ? ???? ?????.

GO? ??? ?????? ??????. C? ?? ??? ? ??? ??? ?? ??? ?? ??? ? ??? ???? ?? ?????. 1. ?? ? ???? ?? ???? Go? OS ???? ?? ? ????? ????? ??? ??, ??, ?? ??? ? ???? ?? ?????. OS.ReadFile? ???? ? ?? ??? ?? ??? ?????. ?? ???? ?? ?? ?? ??? ???? ? ?????. 2. ???? ?? ???? OS/EXEC ???? exec.command ??? ?? ??? ????, ??? ????, ?? ??? ????, ?? ? ?? ??? ?????? ?? ??, ??? ?? ? ?? ????? ??? ???? ????? ?? ? ? ????. 3. ???? ? ??? ???? Net ???? TCP/UDP ?????, DNS ?? ? ?? ??? ?????.

GO ???? ?? ??? ????? ?? ???? ????? ?? ? ???? ???? ??? ??? ???? ????????. ?? ???? ??? ?, ???? ? ??? ?? ??? ???? ?? ?? ? ? ????. 1. func (rrectangle) area () int? ?? ? ???? ???? rect.area ()? ?? ?? ??????. 2. ??? ?? ???? ?? func (r*???) setwidth (...)? ?? ??? ???? ???? ???? ?? ??? ???? ?????. 3. ??? ?? ? ?, ?? ??? ??? ?? ? ???, ?? ??? ?? ?? ?? ? ???. 4. Go? Getter/Setter? ??? ???? ??????.

GO?? ?????? ??? ???? ?? ??? ???? ?????. ?????? ??? ???? ???? ??? ??? ???? ?? ??? ?????? ???? ??????. ?? ??, speak () ???? ?? ? ??? ?????? ???? ???? ???? ?? ??? ???? ?? ? ? ????. ?????? ???? ??, ?? ?? ?? ?? ? ????? ?? ????? ???? ? ?????. ?????? ???? ????? ???? ???? ??? ??? ???? ??? ?? ??? ???? ?? ?????? ?????. ???? ?? ???? ??, ??, ?? ?????? ?? ???? ??? ? ?? ???? ?????. ?? ??, ?? ?? ??? ?? ??? ??? ???? ??? Anno? ??? ? ????.

Go Language?? ??? ??? ?? ??? ??? ? ?? ??? ?? ?????. 1.Strings.contains ()? ???? ?? ???? ???? ??? ??? ???? ?? ?? ???? ? ?????. 2.strings.index ()? ???? ?? ???? ???? ??? ?? ? ??? ???? ??? -1? ?????. 3.strings.replaceall ()? ?? ???? ?? ??? ?? ? ? ??? Strings.replace ()? ?? ?? ?? ?? ? ? ????. 4.Len () ??? ???? ??? ??? ?? ? ????? ?? ??? ?? ? ?? ??? ???? ?????? ???????. ??? ??? ?? ??? ???, ??? ?? ?? ? ??? ??? ?? ?????? ?????.

TheGoiopackageprovidesinterfaceslikeReaderandWritertohandleI/Ooperationsuniformlyacrosssources.1.io.Reader'sReadmethodenablesreadingfromvarioussourcessuchasfilesorHTTPresponses.2.io.Writer'sWritemethodfacilitateswritingtodestinationslikestandardoutpu
