Go 1.22 yakatoburitswa, dzidza nezve maficha ayo matsva nekuvandudzwa

goland

Go inguva imwe chete, yakanyorwa programming mutauro ine static typing inofemerwa neC syntax.

Shanduro itsva ye Enda 1.22, inosvika mwedzi mitanhatu mushure meshanduro 1.21, nehuwandu hwekuchinja kunoshamisa kune chishandiso, nguva yekumhanya, optimization kuvandudzwa, compiler kuvandudzwa uye maraibhurari.

Kune avo vasingazive nezve Go, ndinofanira kukuudza kuti ndizvoMutauro wemapurogiramu urikudziridzwa neGoogle nekutora chikamu kwenharaunda semhinduro yakasanganiswa iyo inosanganisa kuita kwepamusoro kwemitauro yakaunganidzwa nezvakanakira senge mitauro yekunyora senge nyore kunyora kodhi, kukurumidza kwekusimudzira uye dziviriro kubva mukukanganisa.

Main nyowani maficha eGo 1.22

Mune iyi vhezheni nyowani, iyo inounzwa kubva kuGo 1.22, inoratidzira shanduko mbiri mu "for" loopskubvira Kare, mabhii aitaurwa nea for loop akagadzirwa kamwe chete uye akagadziridzwa mune imwe neimwe iteration. MuGo 1.22, imwe neimwe iteration ye loop inogadzira mitsva mitsva kudzivirira kukanganisa kugovana netsaona, kuwedzera Yakawedzera tsigiro yekuyedza (GOEXPERIMENT=rangefunc) yemhando yemabasa kune zvishwe, iyo inokutendera kuti utaure basa senge iterator uye yakagadzirisa nyaya yakagara kwenguva refu neyezvishwe izvo zvakakonzera kuti coroutine call igovane loop variables pakati pekudzokorora. Pamusoro pezvo, zvishwe zvino zvinokwanisa kutenderera nenhamba. Semuyenzaniso:

pasuru huru yekutenga "fmt" func main() {ye ini := range 10 {fmt.Println(10 - i)} fmt.Println("go1.22 inosimuka!")}

Imwe shanduko yakakurumbira mune iyi vhezheni itsva kuiswa kweiyo kugona kushandisa dhairekitori «mutengesi« iyo ine nzvimbo yebasa inotsamira. Zvino mirairo unogona kushandisa dhairekitori iri, iro rakagadzirwa ne `enda kubasa mutengesi` uye inoshandiswa mukuvaka mirairo kana ` yaiswa-mod`mu"mutengesi«, iyi ndiyo yakasarudzika kukosha kana dhairekitori iripo «mutengesi»munzvimbo yekushanda.

Zvakakosha kuziva kuti kushanda kwe `enda unotora` haisisiri kutsigirwa kunze kwemodule mumodhi GOPATH nhaka Zvisinei, mamwe kuvaka mirairo yakafanana `enda unovaka` uye `enda kunoedza` Ivo vacharamba vachishanda nekusingaperi kune legacy GOPATH zvirongwa. Uyezve, murayiro `enda mod init` haichayedza kupinza module zvinodiwa kubva kumigadziriso mafaera emamwe «"kutengesa" (seGopkg.lock).

Go 1.22 inosuma a new package io/zvisina kuchengeteka iyo inopa mashandiro ekushanda nemanongedzo uye ndangariro dzisina kuchengeteka. Iyi pasuru inopa nzira dzekushandura anonongedzera kuenda uye kubva kune akachengeteka uye asina kuchengetedzeka mhando, pamwe nekuita ndangariro kopi mashandiro pasina miganhu yekutarisa.

Basa rakaramba richisanganisira optimizations mucompiler zvichienderana nemhedzisiro yepPGO kodhi profiling, uye ndizvo ikozvino mugadziri anoshandisa devirtualization maturusi kutsiva zvisina kunanga mafoni yenzira dzakasiyana-siyana nekuwedzera inline block execution. Pakagoneswa PGO, shanduko yakawedzerwa yakavandudza mashandiro ezvirongwa zvakawanda ne2% kusvika 14%.

Mune shanduro ye Enda kune Windows, zvirongwa zvinobatanidza kana kurodha maraibhurari Enda unovakwa ne -buildmode=c-dura o -buildmode=c-yakagoverwa ikozvino unogona kushandisa Chiitiko Logging Windows (ETW) API kuburikidza nemapakeji matsva nguva yekumhanya/kutsvaga y tracehook, iyo inoshandisa Go event trace collection protocol semupi weETW.

Pane dzimwe shanduko dzinobuda pachena:

  • Kuraira enda test-chivharo ikozvino inodhinda pfupiso yekuvhara yemapakeji akavharwa asina iwo ega mafaira ebvunzo.
  • os/exec, kugona kutsanangura hunhu hwemamiriro akawedzerwa kwakawedzerwa, zvichikubvumidza kuti uise zvakakosha senge rekushanda dhairekitori, nharaunda zvinosiyana, uye yekuisa / kubuda faira tsananguro yemirairo yakaitwa.
  • Yakagadziridzwa ndangariro manejimendi munguva yekumhanya, zvichikonzera kuwedzera kwe1% kusvika 3% kuita uye kuderedzwa kwe1% mukushandiswa kwendangariro kune akawanda maapplication.
  • Package mambure/http, basa rakawedzerwa CloseIdleConnections kune HTTP mutengi, iyo inovhara zvese zvisina basa zvinongedzo izvo mutengi achangobva kushandisa
  • Kuitwa kwakavandudzwa kwekuyedza (GOEXPERIMENT=newinliner) kweiyo nzira yekuisa yekufona yawedzerwa kune iyo compiler, iyo inoshandisa heuristics kuparadzanisa mashandiro akakosha kubva kune asina kukosha.
  • Package yawedzerwa » math/rand/v2 »kuraibhurari yakajairika, iyo inopa inowirirana API uye inoshandisa nekukurumidza algorithms kugadzira nhamba dzepseudorandom.
  • Package net/http.ServeMux Yakawedzera kugona kutsanangura nzira uye masiki mumatemplate.

Pakupedzisira, kana uri kuda kuziva zvakawanda nezvazvo, unogona kutarisa ruzivo Mune inotevera chinongedzo.


Siya yako yekutaura

Your kero e havazobvumirwi ichibudiswa. Raida minda anozivikanwa ne *

*

*

  1. Inotarisira iyo data: Miguel Ángel Gatón
  2. Chinangwa cheiyo data: Kudzora SPAM, manejimendi manejimendi.
  3. Legitimation: Kubvuma kwako
  4. Kutaurirana kwedata
  5. Dhata yekuchengetedza: Dhatabhesi inobatwa neOccentus Networks (EU)
  6. Kodzero: Panguva ipi neipi iwe unogona kudzora, kupora uye kudzima ruzivo rwako