GO? ??, ??? ? ???? ?? ??? ??? ? ??? ????. 1) ?? : GO? ??? ????? ????? ???? ??? ????? ??????. 2) ??? : ??? ? ?? ?????? ?? ???? ?? ?? ???? ??????. 3) ??? : GO? ???? ?? ??? ???? ???? ??? ?? ??? ? ?? ??? ?????.
引言
Golang ?? Go? 2009 ? Google? ?? ? ??? ????? ???? ??? ??? ????. ??? ????? ???? ?????? ??? ???? ?? ?? ???? ?? ??????. ? ????? GO? ??, ??? ? ??? ???? ??? ??? ??? ????, ???? ??? ???? ???? ??? ?? ??? ??? ????.
? ??? ?? ??, GO? ?? ?? ???? ??? ?? ????? ?????? Go-to ??? ?? ????? ??? ? ??? ??? ? ? ??? ? ????.
?? ??? ?? ???????
??? Nitty-Gritty? ???? ??, ? ?? ?? ??? ?? ?? ?????. GO? ???? ?? ? ??? ? ???, ?? ??? ?????? ?? ??? ???? ???? ???? ?? ??????. ?? ?? ??? ???? ????? ?????.
GO? ?? ?? ? ??? ?? ?? ? ??? ?? ?? ??? ?????. ?? ?? ???? ????? ?? ??? ?? ???? ??? ????? ?? ????? ??? ? ????.
?? ??? ?? ??
??
Go? ??? ?? ??? ?? ? ?????. ??? ????? ????? ????? ???????. ? ???, Go? ?? ?? ??? ?? 2 ??? ? ? ?????? ?? ? ? ?? ??????.
// ??? GO ????? ? ??? ?? <p>"FMT"?? ??</p><p> func main () { fmt.println ( "?????,?!") }</p>
?? ?? ? ??? GO? ???? ??? ?? ??? ? ??? ? ??? ?????. ?? ??? Go? ????? ???? ?? ?????? ?? ??? ????? ???? ?????.
Go? ??? ?? ??? ?? ?? ????. ??? ??? ?? ????. GO? ??? ???? ?? ?? ??? ?????? ??????, ?? ??? ???? ??? ?? ???? ?? ????? ?????.
??
GO? ???? ?? ??? ???? ????. ? ? ?? ???? ????. GO? ?? ?????? ????? ?? ???? ???? ????. ?? ?? ???????? ???? ???? ??? ?? ????? ???? ???? ??????.
// ???? ?? ??? ? ??? ?? <p>?? (??) "Bufio" "FMT" "OS" ))</p><p> func main () { ??, err : = os..s. err! = nil {? ?? fmt.println (err) ?? } DEFER FILE.CLOSE ()</p><pre class='brush:php;toolbar:false;'> ??? : = bufio.newscanner (??) Scanner.scan () ? { fmt.println (scanner.text ()) } err : = scanner.err (); err! = nil { fmt.println (err) }
}
? ??? GO? ?? ?????? ???? ??? ????? ?? ??? ?????. bufio
???? ?? ?? ???? ???? ?? ? ??? ?? ? ????? ??? ?????.
??
Go? ???? ??? ?? ??? ?? ? ????. ? ??? ???? ????? ??? ???? ??? ???????. ? ???,? ???? ??? ?? ?? ??? ?????.
// ???? ??? HTTP ??? ? ??? ?? <p>?? (??) "FMT" "net/http" ))</p><p> func handler (w http.responsewriter, r *http.request) { fmt.fprintf (w, "?????, ?? %s? ?????!", r.url.path [1 :]) }</p><p> func main () { http.handlefunc ( "/", ???) http.listenandserve ( ": 8080", NIL) }</p>
? ? ??? GO?? ?? HTTP ??? ???? ?? ??? ?? ? ?????. ??? ????? ?? ?????? ??? ? ? ??? ?? ??? ??? ?????.
?? ??
??? ??
?? ???? ???? ???? ?? ???? ?????? ??????. ??? ? ??? ?? ???? ???? ?????. ??? ??? ??? ?????? ?? ??? ? ????.
// ???? ???? ???? ? ??? ?? <p>?? (??) "FMT" "??" ))</p><p> FUNC ProcessRecord (??? ???) { // ?? ??? ???????? Time.sleep (1 * time.millisecond) }</p><p> func main () { ?? : = Make ([] String, 1000000) ?? : = time.now ()</p><pre class='brush:php;toolbar:false;'> _, ??? : = ?? ??? { ProcessRecord (???) } ?? ?? : = Time.since (??) fmt.printf ( " %v \ n? ?? ? %d ???", Len (???), ??)
}
? ??? GO? ??? ??? ??? ????? ???? ??? ?????. ??? ??? Go? ?? ??? ????? ??? ???? ??????.
??? ???
?? ??????? ???? ??? ????? ????????. ?? ?? ???? Go? ???? ???? ???????. ??? ???? ? ?????.
// ?? ??? ???? ???? ? ??? ?? <p>?? (??) "???/json" "FMT" "net/http" ))</p><p> ?? Message Struct { ??? ??? <code>json:"text"</code> }</p><p> func handler (w http.responsewriter, r *http.request) { var msg ??? err : = json.newdecoder (r.body) .decode (& msg); err! = nil { http.error (w, err.error (), http.statusbadrequest) ?? }</p><pre class='brush:php;toolbar:false;'> fmt.fprintf (w, "?? ??? : %s", msg.text)
}
func main () { http.handlefunc ( "/", ???) http.listenandserve ( ": 8080", NIL) }
? ??? GO? ?? ?????? ???? ???? ???? ???? ??? ???? ??? ?????. GO? HTTP ???? ???? ???? ?? ????? ? ???? ??????.
??? ???
?? ? ? ??? ??? ?? ???????. ??? ????? ?? ? ?? ???? ??? ???? ??????. ??? ??? ???? ? ??? ??? ????.
// ?????? ??? GO ????? ? ??? ?? <p>"FMT"?? ??</p><p> func main () { ?? : = "???" fmt.printf ( "?????, %s! ?? ?? ?????. \ n", ??) }</p>
? ??? GO? ???? ?? ? ?? ?????? ??? ??? ? ??? ??? ?????.
???? ?? ? ??? ?
Go? ????? ????? ??? ???? ? ???? ??? ????. ??? ?? ? ??? Goroutines? ????, ??? ???? ??? ?? ???? ??? ? ????.
// ???? ?? ??? ? ??? ?? <p>?? (??) "FMT" "??" ))</p><p> var ??? int</p><p> ?? ?? (wg *sync.waitgroup) { ??? wg.done () }</p><p> func main () { var wg sync.waitgroup i : = 0; I <1000; ? { wg.add (1) ? ?? (& wg) } wg.wait () fmt.println ( "?? ??? :", ???) }</p>
? ??? ?? ??? ?????. ?? ???? ???? ???? ????? ?? ? ?? ?? ?? ??? ???????.
? ?? ???? ??? ?? ?????. Go? ??? ?? ??? ????, ?? ?? ? ? ??? ??? ??? ???? ? ??????. ??? ??? ?? ??? ????.
// ?? ??? ??? ?? ??? ? ??? ?? <p>?? (??) "FMT" "OS" ))</p><p> func main () { ??, err : = os..s. err! = nil {? ?? fmt.println ( "?? ??? ?? :", err) ?? } DEFER FILE.CLOSE ()</p><pre class='brush:php;toolbar:false;'> // ??? ?????
}
?? ??? ? ?? ??
??? ????? ?? ??? ? ?? ??? ??? ?? ?? ?????. ?? ?? ? ??? ??? ?????. Go? ??? ???? ?????? ??? ????? ??? ??? ? ? ????.
// ?? ???? ???? ? ??? ?? <p>?? (??) "FMT" "?" ))</p><p> func main () { // ???? ? ?? var ?? ??? i : = 0; I <1000; ? { ?? = fmt.sprintf ( "%d", i) }</p><pre class='brush:php;toolbar:false;'> // ???? ?? var builder strings.builder i : = 0; I <1000; ? { builder.writestring (fmt.sprintf ( "%d", i)) } ?? = builder.string () fmt.println (??)
}
? ??? strings.Builder
???? ?? ??? ???? ? ???? ??? ??? ?????.
? ?? ?? ??? GO? ?? ???? ? ??? ???? ???? ?? ??? ???? ????. ??? pprof
??? ?? ??? ?? ??? ????.
// ???? ?? PPROF? ???? ? ??? ?? <p>?? (??) "net/http" _ "net/http/pprof" ))</p><p> func main () { go func () { http.listenandserve ( "Localhost : 6060", NIL) } () // ???? ?? ???? ?? }</p>
? ??? ?? ????? ??? ???? ?? ??? ? ??? ???? ? ??? ?????.
??
Golang? ????? ??? ??? ??? ?? ? ? ????. ??, ??? ? ????? ?? ? ????? ??? ??? ????? ???? ?? ????? ??? ??????. ???? ??? ?? ??? ?? GO? ?? ????? ???? ? ??? ????? ???? ?? ??? ?????.
GO?? ??? ????? ??? ???? ???? ??? ????? ?? ???? ?? ??? ?? ???????. ??? ??!
? ??? Golang? ?? : ??, ??? ? ???? ?? ?????. ??? ??? 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??? ???? ??? ?? ?? ?? ?????. ??? ??? ????. ?? ?? ?? ??? ???? ?? ?? ?? ?? ??? ?? ???? ?? ?? ?? ?? ??? ??? ??? ??? ??????? ???? ?????.

??? ?? ?? : ??? ???? ??? ????? ??? ???? ?????? ?? ??? ??? ?? ???? ???? ??? ????? ?? Nodejs? ??? ??? ????.

Golang? ????? C?? ?? C? ?? ???? Golang?? ????. 1) Golang? Goroutine ? Channel? ?? ???? ???? ????, ?? ?? ?? ??? ???? ? ?????. 2) C ???? ??? ? ?? ?????? ?? ????? ??? ???? ???? ??? ???? ??? ??????? ?????.

Golang? ?? ?? ? ?? ????? ???? C? ??? ?? ? ??? ??? ??? ????? ?????. 1) Golang? ??? ?? ? ??? ????? ?? ??? ?????, ??? ? ??? ??? ?????. 2) C? ?? ??? ?? ? ???? ???? ?? ??? ? ??? ???? ???? ??? ??? ?????.

GO? ?? ?????? ????? ? ??? ?? ?? ?????? ?? ????? GO? ????? ? ? ???? ?? ? ?? ???? ??? ????.

Golang? ??? ?? ? ???? Python?? ????. 1) Golang? ??? ?? ??? ???? ??? ??? ?? ??? ?????? ? ?????. 2) ?? ? ???? ???? ??? ????? Cython? ?? ??? ?? ??? ??? ? ? ????.

Go Language? ????? ?? ??? ???? ???? ? ? ?????. ??? ??? ????. 1. ??? : ?? ??? ???, ?? ??? ??; 2. ?? ????? : ?? ?? ? ??? ?? ?? ??? ???; 3. ??? : ??? ??, ?? ? ?? ?? ?? ??; 4. ??? ??? : ??? ??? ???, ?? ??? ?????.

Golang? Python? ?? ?? ? ??? ????. Golang? ??? ? ?? ?????? ????? Python? ??? ?? ? ? ??? ?????. Golang? ??? ??? ???? ???? ???? Python? ??? ?? ? ??? ????? ???? ?????.
