I-Go 1.22 isivele ikhishiwe, funda ngezici zayo ezintsha nentuthuko

IGoland

I-Go iwulimi lokuhlela oluhlangene, oluhlanganisiwe olunokuthayipha okumile okugqugquzelwe i-syntax C.

Uhlobo olusha lwe Hamba 1.22, ifika ezinyangeni eziyisithupha ngemva kwenguqulo 1.21, ngenani lezinguquko eziphawulekayo kusethi yamathuluzi, isikhathi sokusebenza, ukuthuthukiswa kokuthuthukisa, ukuthuthukiswa komhlanganisi namalabhulali.

Kulabo abangazi ngeGo, kumele nginitshele ukuthi lokhu kunjaloUlimi lokuhlela oluthuthukiswa i-Google ngokubamba iqhaza komphakathi njengesixazululo esiyingxubevange esihlanganisa ukusebenza okuphezulu kwezilimi ezihlanganisiwe nezinzuzo ezifana nezilimi zokubhala ezifana nokubhala kalula kwekhodi, isivinini sokuthuthuka nokuvikelwa kumaphutha.

Izici ezintsha eziyinhloko zeGo Go 1.22

Kule nguqulo entsha, eyethulwe ku-Go 1.22, igqamile izinguquko ezimbili ku-"for" loops, kusukela Ngaphambilini, okuguquguqukayo okumenyezelwe i-loop kudalwe kanye futhi zabuyekezwa ekuphindaphindweni ngakunye. Ku-Go 1.22, ukuphindaphinda ngakunye kweluphu kudala okuhlukile okusha ukugwema amaphutha okwabelana ngephutha, ngaphezu kwalokho Kwengezwe ukwesekwa kokuhlola (GOEXPERIMENT=rangefunc) kumisebenzi yobubanzi ukuya kumaluphu, okukuvumela ukuthi ucacise umsebenzi njenge-iterator futhi ixazulule udaba osekunesikhathi eside lukhona ngamalophu okubangele amakholi we-coroutine ukwabelana ngokuguquguquka kwe-loop phakathi kokuphindaphinda. Ukwengeza, amaluphu manje angangena kuma-integer. Ngokwesibonelo:

ukungenisa kwephakheji okuyinhloko "fmt" func main() { for i := range 10 { fmt.Println(10 - i) } fmt.Println("go1.22 iyasuka!")}

Olunye ushintsho oluphawulekayo kule nguqulo entsha ukwethulwa kwe- ikhono lokusebenzisa uhla lwemibhalo «umdayisi« equkethe ukuncika kwendawo yokusebenza. Manje imiyalo ungasebenzisa lolu hlu lwemibhalo, olwakhiwe nge `hamba umthengisi` futhi isetshenziswa emiyalweni yokwakha uma ` isethiwe-imodi`ku-"umdayisi«, lokhu kuyinani elizenzakalelayo lapho uhla lwemibhalo lukhona «umdayisi» endaweni yokusebenza.

Kubalulekile ukuqaphela ukuthi ukusebenza kwe `hamba uyolanda` ayisasekelwa ngaphandle kwemojuli ekumodi I-GOPATH ilifa Nokho, eminye ukwakha imiyalo efana `hamba uyokwakha` futhi `hamba uyohlola` Bazoqhubeka nokusebenza unomphela ezinhlelweni ze-GOPATH zefa. Ngaphezu kwalokho, umyalo `hamba mod init` ngeke zisazama ukungenisa izimfuneko zemojula ukusuka kumafayela okumisa amanye «"ukuthengisa" (njenge-Gopkg.lock).

I-Go 1.22 yethula i-a iphakethe elisha io/engaphephile ehlinzeka ngokusebenza kokusebenza ngezikhombisi nenkumbulo engaphephile. Le phakheji ihlinzeka ngezindlela zokuguqula izikhombisi ziye futhi zisuke ezinhlotsheni eziphephile nezingaphephile, kanye nokwenza imisebenzi yokukopisha inkumbulo ngaphandle kokuhlola imingcele.

Umsebenzi uqhubekile nokufaka ukulungiselelwa ku-compiler ngokusekelwe emiphumeleni ye-pIphrofayili yekhodi ye-PGO, futhi lokho manje umhlanganisi usebenzisa amathuluzi okukhipha amandla ukuze abuyisele izingcingo ezingaqondile yezindlela ezahlukahlukene ezinokwenyuswa kwebhulokhi esemgqeni. Lapho i-PGO inikwe amandla, ushintsho olungeziwe lwathuthukisa ukusebenza kwezinhlelo eziningi ngo-2% kuya ku-14%.

Enguqulweni ye Iya ku-Windows, izinhlelo ezixhumanisa noma ezilayisha imitapo yolwazi Hamba wakhiwe nge -imodi yokwakha=c-ingobo yomlando o -imodi yokwakha=c-kwabelwane manje ingasebenzisa i-API Yokugawula Imicimbi YeWindows (ETW). ngokusebenzisa amaphakheji amasha isikhathi sokusebenza/ukulandelela y umkhondo, esebenzisa iphrothokholi yokuqoqwa komcimbi we-Go njengomhlinzeki we-ETW.

Kwezinye izinguquko ezigqamile:

  • Umyalo hamba test -cover manje iphrinta izifinyezo zokufakwa kwamaphakheji ahlanganisiwe angenawo amafayela awo okuhlola.
  • os/eqe, ikhono lokuchaza izibaluli zomongo lengeziwe, okukuvumela ukuthi usethe amanani anjengohla lwemibhalo olusebenzayo, okuguquguqukayo kwemvelo, kanye nesichazi sefayela lokufaka/lokukhiphayo lemiyalo ekhishiwe.
  • Ukuphathwa kwememori okulungiselelwe ngesikhathi sokusebenza, okuholela ekwenyukeni kokusebenza okungu-1-3% kanye nokwehliswa okungu-1% kokusetshenziswa kwenkumbulo ezinhlelweni eziningi.
  • Iphakheji inetha/http, umsebenzi wengeziwe CloseIdleConnections kuklayenti le-HTTP, elivala konke ukuxhumana okungenzi lutho iklayenti elisanda kulisebenzisa
  • Ukuqaliswa kokuhlolwa okuthuthukisiwe (GOEXPERIMENT=newinliner) kwendlela yokufaka ikholi yengezwe kumdidiyeli, okusebenzisa i-heuristics ukuze kuhlukaniswe imisebenzi ebalulekile kunengabalulekile.
  • Iphakheji yengeziwe » izibalo/irandi/v2 »kumtapo wolwazi ojwayelekile, ohlinzeka nge-API engaguquguquki futhi esebenzisa ama-algorithms asheshayo ukwenza izinombolo zomgunyathi.
  • Iphakheji net/http.ServeMux Kwengezwe ikhono lokucacisa izindlela namamaski kuzifanekiso.

Ekugcineni, uma ukhona unentshisekelo yokwazi okwengeziwe ngayo, ungabheka imininingwane Kulesi sixhumanisi esilandelayo.


Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.