IGo 1.22 sele ikhutshiwe, funda malunga neempawu zayo ezintsha kunye nophuculo

UGoland

I-Go lulwimi lwenkqubo oluhlanganisiweyo, oluqokelelweyo ngochwethezo olungatshintshiyo oluphefumlelwe nguC isintaksi.

Inguqulelo entsha ye Hamba 1.22, ifika kwiinyanga ezintandathu emva kwenguqulo 1.21, ngenani leenguqu eziphawulekayo kwi-toolset, ixesha lokuqhuba, ukuphuculwa kokuphucula, ukuphuculwa komqokeleli kunye namathala eencwadi.

Kwabo bangaziyo ngeGo, kufuneka ndikuxelele ukuba okuLulwimi lwenkqubo oluphuhliswa nguGoogle ngokuthatha inxaxheba koluntu njengesisombululo esixubeneyo esidibanisa ukusebenza okuphezulu kweelwimi ezihlanganisiweyo kunye nezibonelelo ezinjengeelwimi zokubhala ezinjengokubhala ikhowudi, isantya sophuhliso kunye nokukhuselwa kwiimpazamo.

Iimpawu ezintsha eziphambili ze-Go 1.22

Kule nguqulo entsha, eyaziswa ukusuka kwi-Go 1.22, igxininisa utshintsho ezimbini kwi "for" iilophu, ukususela Ngaphambili, izinto eziguquguqukayo ezichazwe yi a for loop zenziwe kanye kwaye zahlaziywa kuphindaphindo ngalunye. Kwi-Go 1.22, i-iteration nganye ye-loop yenza izinto ezintsha eziguquguqukayo ukuphepha iimpazamo zokwabelana ngempazamo, ukongeza Inkxaso yomfuniselo eyongeziweyo (GOEXPERIMENT=rangefunc) yoluhlu lwemisebenzi yokuluphu, ekuvumela ukuba ukhankanye umsebenzi njenge iterator kunye kusonjululwe umba ekudala ukho ngeelophu ebangele iifowuni ze-coroutine ukwabelana ngokuguquguquka kwe-loop phakathi kophindaphindo. Ukongeza, iilophu ngoku ziyakwazi ukujikeleza ngenani elipheleleyo. Umzekelo:

ipakethe ephambili yokungenisa "fmt" func main() {ye i := uluhlu 10 { fmt.Println(10 - i) } fmt.Println("go1.22 iqala!")}

Olunye utshintsho oluphawulekayo kolu guqulelo lutsha kukuqaliswa kwe ukukwazi ukusebenzisa uvimba weefayili «umthengisi« equlathe ukuxhomekeka kwindawo yokusebenza. Ngoku imiyalelo ungasebenzisa olu lawulo, olwenziwe nge `hamba umthengisi` kwaye isetyenziswa kwimiyalelo yokwakha xa ` isetiwe-modkwi «umthengisi«, eli lixabiso elingagqibekanga xa ulawulo lukhona.umthengisi» kwindawo yokusebenza.

Kubalulekile ukuqaphela ukuba ukusebenza kwe `hamba uyokuthatha` ayisaxhaswanga ngaphandle kwemodyuli ekwimo IGOPATH ilifa Nangona kunjalo, eminye imiyalelo yokwakha efana `hamba uyokwakha` kwaye `hamba uyokuvavanya` Baza kuqhubeka nokusebenza ngokungenasiphelo kwiinkqubo ze-GOPATH zelifa. Ngapha koko, umyalelo `hamba mod init` ayisayi kuphinda izame ukungenisa iimfuno zemodyuli kwiifayile zoqwalaselo zabanye."ukuthengisa" (njengeGopkg.lock).

Hamba 1.22 wazisa a iphakheji entsha io/engakhuselekanga ebonelela ngokusebenza ukusebenza ngezikhombisi kunye nememori engakhuselekanga. Le phakheji ibonelela ngeendlela zokuguqula izikhombisi ukuya kunye nokusuka kwiintlobo ezikhuselekileyo nezingakhuselekanga, kunye nokwenza imisebenzi yekopi yememori ngaphandle kokujonga imida.

Umsebenzi waqhubeka nokubandakanya ukulungiswa kwi-compiler ngokusekelwe kwiziphumo zepIkhowudi yephrofayili yePGO, y Que ngoku umqokeleli usebenzisa izixhobo ze-devirtualization ukubuyisela iifowuni ezingathanga ngqo yeendlela ezahlukeneyo kunye nokuphunyezwa kwebhloko engaphakathi eyandisiweyo. Xa iPGO yenziwe yasebenza, utshintsho olongeziweyo lwaphucula ukusebenza kweenkqubo ezininzi nge-2% ukuya kwi-14%.

Kwinguqulelo ye Yiya kwiiWindows, iinkqubo eziqhagamshela okanye ezilayisha iilayibrari Hamba wakhiwe nge -indlela yokwakha=c-ugcino o -indlela yokwakha=c-kwabelwana ngayo ngoku ingasebenzisa i-API yokuLoga iMisitho yeWindows (ETW) API ngeepakethe ezintsha ixesha lokubaleka/umkhondo y umkhondo, ephumeza iprotocol yokuqokelela umkhondo womsitho weGo njengomboneleli weETW.

Olunye utshintsho olwahlukileyo:

  • Umyalelo hamba uvavanyo-ikhava ngoku iprinta izishwankathelo zekhava yeepakethe ezigqunyiweyo ezingenazo iifayili zazo zovavanyo.
  • os/exec, ukukwazi ukuchaza iimpawu zomxholo kongeziwe, okukuvumela ukuba usete amaxabiso anje ngolawulo olusebenzayo, izinto eziguquguqukayo zemekobume, kunye negalelo/imveliso yenkcazelo yefayile yemiyalelo ephunyeziweyo.
  • Ukulawulwa kwememori ephuculweyo ngexesha lokuqhuba, okukhokelela kwi-1% ukuya kwi-3% yokwanda komsebenzi kunye nokunciphisa i-1% yokusetyenziswa kwememori kwizicelo ezininzi.
  • Iphakheji umnatha/http, umsebenzi wongeziwe CloseIdleConnections kumxhasi weHTTP, evala lonke uqhagamshelo olungasebenziyo olusanda kusetyenziswa ngumxhasi
  • Ukuphunyezwa kovavanyo oluphuculweyo (GOEXPERIMENT=newinliner) kwendlela yokufaka umnxeba yongezwe kumqokeleli, osebenzisa i-heuristics ukwahlula imisebenzi ebalulekileyo kwengabalulekanga.
  • Ipakethi yongeziwe » izibalo/irandi/v2 » kwilayibrari eqhelekileyo, enikezela nge-API engaguqukiyo kwaye isebenzisa i-algorithms ekhawulezayo ukuvelisa amanani enkohliso.
  • Iphakheji umnatha/http.ServeMux Yongezwe ukukwazi ukucacisa iindlela kunye neemaski kwiitemplates.

Ekugqibeleni, ukuba ukhona unomdla wokwazi ngakumbi ngayo, ungajonga iinkcukacha Kule khonkco ilandelayo.


Shiya uluvo lwakho

Idilesi yakho ye email aziyi kupapashwa. ezidingekayo ziphawulwe *

*

*

  1. Uxanduva lwedatha: UMiguel Ángel Gatón
  2. Injongo yedatha: Ulawulo lwe-SPAM, ulawulo lwezimvo.
  3. Umthetho: Imvume yakho
  4. Unxibelelwano lwedatha: Idatha ayizukuhanjiswa kubantu besithathu ngaphandle koxanduva lomthetho.
  5. Ukugcinwa kweenkcukacha
  6. Amalungelo: Ngalo naliphi na ixesha unganciphisa, uphinde uphinde ucime ulwazi lwakho.