An riga an saki Go 1.22, koyi game da sabbin fasalulluka da haɓakawa

goland

Go shine yaren shirye-shirye da aka haɗa tare tare da buga rubutu a tsaye ta hanyar C syntax.

Sabuwar sigar Go 1.22, ya zo watanni shida bayan sigar 1.21, tare da ɗimbin manyan canje-canje ga kayan aiki, lokacin aiki, haɓaka haɓakawa, haɓaka haɓakawa da ɗakunan karatu.

Ga wadanda basu sani ba game da Go, dole ne in gaya muku cewa wannan shineYaren shirye-shirye ne da Google ke haɓakawa tare da sa hannu na al'umma a matsayin mafita mai haɗaka wanda ya haɗu da babban aiki na harsunan da aka haɗe tare da fa'ida kamar rubutun harsuna kamar sauƙi na rubuta lambar, saurin ci gaba da kariya daga kurakurai.

Tafi 1.22 babban labarai

A cikin wannan sabon sigar, wanda aka gabatar daga Go 1.22, yana ba da haske canje-canje biyu a cikin madaukai "don".tunda A baya can, an ƙirƙiri masu canji da aka ayyana ta hanyar madauki sau ɗaya kuma an sabunta su a kowane juzu'i. A cikin Go 1.22, kowane juzu'in madauki yana ƙirƙirar sabbin masu canji don guje wa kurakuran rabawa na bazata, ƙari Ƙara goyan bayan gwaji (GOEXPERIMENT=rangefunc) don ayyuka masu iyaka zuwa ga madaukai, wanda ke ba ka damar ƙididdige aiki azaman mai maimaitawa da ya warware wani dogon batu tare da madaukai wanda ya haifar da kiran coroutine don raba madaidaicin madauki tsakanin maimaitawa. Bugu da ƙari, don madaukai yanzu na iya yin madauki ta hanyar lamba. Misali:

kunshin main shigo da "fmt" func main() {na i:= kewayon 10 {fmt.Println(10 - i) } fmt.Println("go1.22 take off!")}

Wani babban canji a cikin wannan sabon sigar shine gabatarwar iya amfani da directory"mai siyarwa« wanda ya ƙunshi abubuwan dogaro da sararin aiki. Yanzu umarni za ka iya amfani da wannan directory, wanda aka ƙirƙira tare da `je mai sayar da aiki` kuma ana amfani da shi wajen gina umarni lokacin da aka saita- mod'in"mai siyarwa", wannan shine ƙimar tsoho lokacin da kundin adireshi ya kasance"mai siyarwa»a cikin wurin aiki.

Yana da mahimmanci a lura cewa aikin na `tafi samu`Ba a ƙara samun tallafi a wajen wani tsari a yanayin GOPATH Gada Duk da haka, sauran gini umarni kamar 'je gina' kuma 'tafi gwaji' Za su ci gaba da aiki har abada don shirye-shiryen GOPATH na gado. Bugu da ƙari, umarnin 'go mod init' ba zai ƙara ƙoƙarin shigo da buƙatun module daga fayilolin sanyi na wasu «"mai sayarwa" (kamar Gopkg.lock).

Go 1.22 yana gabatar da a sabon kunshin io/mara lafiya wanda ke ba da ayyuka don aiki tare da masu nuni da ƙwaƙwalwar ajiya mara lafiya. Wannan fakitin yana ba da hanyoyi don juyar da masu nuni zuwa kuma daga nau'ikan aminci da marasa lafiya, da kuma yin ayyukan kwafin ƙwaƙwalwar ajiya ba tare da bincika iyakoki ba.

Aikin ya ci gaba da haɗawa da ingantawa a cikin mai tarawa bisa sakamakon pPGO code profile, kuma hakane yanzu mai tarawa yana amfani da kayan aikin ɓarna don maye gurbin kira kai tsaye na hanyoyi daban-daban tare da faɗaɗa aikin toshe layin layi. Lokacin da aka kunna PGO, ƙarin canjin ya inganta aikin yawancin shirye-shirye da 2% zuwa 14%.

A cikin sigar Jeka don Windows, shirye-shiryen da ke haɗa ko loda ɗakunan karatu Tafi gina da -buildmode=c-Archive o -buildmode=c-shared iya yanzu amfani da Event Logging Windows (ETW) API ta hanyar sabbin fakiti lokacin aiki / ganowa y tracehook, wanda ke aiwatar da ka'idar tattara tarin abubuwan taron Go a matsayin mai ba da ETW.

Daga sauran canje-canjen da suka yi fice:

  • Umurnin je gwaji - cover yanzu suna buga taƙaitaccen bayani don fakitin da aka rufe waɗanda basu da nasu fayilolin gwaji.
  • os/exec, an ƙara ikon ayyana halayen mahallin, yana ba ku damar saita dabi'u kamar kundin adireshi, masu canjin yanayi, da bayanin shigarwa/fitarwa fayil don umarni da aka aiwatar.
  • Ingantaccen sarrafa ƙwaƙwalwar ajiya a cikin lokacin aiki, yana haifar da haɓaka aikin 1% zuwa 3% da raguwar 1% na yawan ƙwaƙwalwar ajiya don yawancin aikace-aikace.
  • Kunshin net/http, an ƙara aikin CloseIdleConnections zuwa abokin ciniki na HTTP, wanda ke rufe duk hanyoyin haɗin yanar gizo marasa aiki waɗanda abokin ciniki ya yi amfani da su kwanan nan
  • An ƙara ingantaccen aiwatar da gwajin gwaji (GOEXPERIMENT=newinliner) na hanyar shigar da kira zuwa mai tarawa, wanda ke amfani da ilimin lissafi don raba ayyuka masu mahimmanci daga waɗanda ba su da mahimmanci.
  • An ƙara fakitin » lissafi/rand/v2 »zuwa madaidaicin ɗakin karatu, wanda ke ba da ƙarin daidaiton API kuma yana amfani da algorithms masu sauri don ƙirƙirar lambobi masu ƙima.
  • Kunshin net/http.ServeMux Ƙara ikon tantance hanyoyin da abin rufe fuska a cikin samfuri.

A ƙarshe, idan kun kasance mai sha'awar ƙarin sani game da shi, zaka iya duba bayanan A cikin mahaɗin mai zuwa.


Bar tsokaci

Your email address ba za a buga. Bukata filayen suna alama da *

*

*

  1. Wanda ke da alhakin bayanan: Miguel Ángel Gatón
  2. Manufar bayanan: Sarrafa SPAM, sarrafa sharhi.
  3. Halacci: Yarda da yarda
  4. Sadarwar bayanan: Ba za a sanar da wasu bayanan ga wasu kamfanoni ba sai ta hanyar wajibcin doka.
  5. Ajiye bayanai: Bayanin yanar gizo wanda Occentus Networks (EU) suka dauki nauyi
  6. Hakkoki: A kowane lokaci zaka iyakance, dawo da share bayanan ka.