Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
(Pݴޠ5*14Ћ 5PNPLJ0UB /Pd/P 1
Slide 2
Slide 2 text
5*1 ੜ࢈ऀଆͷΠϯλʔϑΣΠε 2
Slide 3
Slide 3 text
ΠϯλʔϑΣΠεͲ͜ʹ͋Δ͖͔ w ੜ࢈ऀଆ QSPEVDFSTJEF ۩ମతͳ࣮͕ॻ͔Εͨύοέʔδଆ w ফඅऀଆ DPOTVNFSTJEF ΘΕΔ֎෦ύοέʔδଆ 3
Slide 4
Slide 4 text
ੜ࢈ऀଆͷΠϯλʔϑΣΠε 4 +BWB$Ͱɺੜ࢈ऀଆʹ ΠϯλʔϑΣΠεΛॻ͘͜ͱ͕ଟ͍ɻ
Slide 5
Slide 5 text
ੜ࢈ऀଆͷΠϯλʔϑΣΠε 5 (PͰੜ࢈ऀଆʹΠϯλʔϑΣΠεΛ ॻ͘ํ͕·͍͠ɻ ΠϯλʔϑΣΠεΛੜ࢈ऀଆͰ ެ։ͯ͠͠·͏ͱফඅऀଆͷৼΔ͍͕ ੍ݶ͞Εͯ͠·͏ɻ
Slide 6
Slide 6 text
ੜ࢈ऀଆͷΠϯλʔϑΣΠε 6 (PͰKBWBͷΑ͏ʹ JNQMFNFOUTΛ໌ࣔ͠ͳ͍ͷͰ ґଘ͕ؔͳ͍
Slide 7
Slide 7 text
ফඅऀଆʹॻ͘ͱʁ 7 ফඅऀͱґଘؔʹ͓͚Δґଘઌ
Slide 8
Slide 8 text
ফඅऀଆʹॻ͘ͱʁ 8 ফඅऀ ੜ࢈ऀ
Slide 9
Slide 9 text
ফඅऀଆʹॻ͘ͱʁ 9 ফඅऀ ੜ࢈ऀ ґଘؔٯసͷ๏ଇΛద༻ͤͨ͞ґଘؔΛߟ͑Δͱ "ଆͷύοέʔδʹ#ͷJOUFSGBDFΛॻ͍ͨํ͕Θ͔Γ͍͢
Slide 10
Slide 10 text
ੜ࢈ऀଆͱফඅऀଆ 10 ফඅऀ ੜ࢈ऀ ফඅऀଆ ੜ࢈ऀଆ ֎෦ύοέʔδΛ͏ଆ ֎෦ύοέʔδ IBOEMFS VTFDBTF VTFDBTF SFQPTJUPSZ
Slide 11
Slide 11 text
3FQPTJUPSZͷ 11 ͜ΕΠϯλʔϑΣΠεͷݪଇʹ͢Δ
Slide 12
Slide 12 text
ΠϯλʔϑΣΠεͷݪଇ *41 *OUFSGBDF4FHSFHBUJPO1SJODJQMF 12 ιϑτΣΞΛઃܭ͢Δࡍʹ ͍ͬͯͳ͍ͷͷґଘΛճආ͖ͩ͢ͱ͍͏ݪଇ
Slide 13
Slide 13 text
શ࠶ར༻ͷݪଇ $31 13 ίϯϙʔωϯτͷϢʔβʹରͯ͠ ࣮ࡍʹΘͳ͍ͷͷґଘΛڧཁ͍͚ͯ͠ͳ͍ Ұॹʹ༻͍ΒΕΔ͜ͱ͕ଟ͍ΫϥεϞδϡʔϧಉ͡ίϯϙʔωϯτʹ·ͱΊΔɻ ͍ͬͯͳ͍ΫϥεΛ࣋ͭίϯϙʔωϯτʹґଘ͠ͳ͍Α͏ʹ͢Δɻ
Slide 14
Slide 14 text
શ࠶ར༻ͷݪଇ $31 14 ίϯϙʔωϯτͷϢʔβʹରͯ͠ ࣮ࡍʹΘͳ͍ͷͷґଘΛڧཁ͍͚ͯ͠ͳ͍ Ұॹʹ༻͍ΒΕΔ͜ͱ͕ଟ͍ΫϥεϞδϡʔϧಉ͡ίϯϙʔωϯτʹ·ͱΊΔɻ ͍ͬͯͳ͍ΫϥεΛ࣋ͭίϯϙʔωϯτʹґଘ͠ͳ͍Α͏ʹ͢Δɻ
Slide 15
Slide 15 text
3FQPTJUPSZͷ 15 ͜ΕΠϯλʔϑΣΠεͷݪଇʹ͢Δ
Slide 16
Slide 16 text
3FQPTJUPSZͷ 16 https://go.dev/play/p/hfMn1sv8IGx 6TFS3FQPTJUPSZʹ ෆඞཁͳͷ͕ͨ͘͞Μ͋Δ
Slide 17
Slide 17 text
17 ෆཁͳͷʹґଘ͠ͳ͍ʂ
Slide 18
Slide 18 text
5*1 ΠϯλʔϑΣΠεΛฦ͢ 18
Slide 19
Slide 19 text
ΠϯλʔϑΣΠεϑΝΫτϦ ࠶ܝ ΠϯλʔϑΣΠεΛฦ͢ํ๏5JQͰઆ໌ͨ͠ɻ ϙΠϯλΛฦ͢ͷ͕׳ྫత 19
Slide 20
Slide 20 text
ΠϯλʔϑΣΠεϑΝΫτϦ ࠶ܝ ΠϯλʔϑΣΠεΛฦ͢ํ๏5JQͰઆ໌ͨ͠ɻ ϙΠϯλΛฦ͢ͷ͕׳ྫత 20
Slide 21
Slide 21 text
ΠϯλʔϑΣΠεΛฦ͢ 21 ΠϯλʔϑΣΠεΛฦ͢͜ͱ ੜ࢈ऀଆͰΔ͜ͱ͋·Γ·͘͠ͳ͍ ˠJOUFSGBDFΛެ։ͨ͠߹ͷɻ ҰϢʔβʹఏڙͨ͠ΠϯλϑΣʔεΛޙ͔Βมߋ ͢ΔͱطଘͷϢʔβͷίʔυ͕յΕͯ͠·͏ɻ
Slide 22
Slide 22 text
ΠϯλʔϑΣΠεΛฦ͢
Slide 23
Slide 23 text
ΠϯλʔϑΣΠεΛฦ͢ϝϦοτ 23 ۀͰෳਓͰ։ൃ͢Δ߹ɺ୭͔ ͕ΠϯλϑΣʔεʹϝιουΛՃ ͨ͠ࡍʹɺͦͷΠϯλϑΣʔεΛ࣮ ͍ͯ͠ͳ͍TUSVDUΛίϯύΠϧΤ ϥʔʹͰ͖Δ https://go.dev/play/p/XeKfOtLYzji
Slide 24
Slide 24 text
TUSVDUΛฦ͢ 24 TUSVDUɺTUSVDUͷϙΠϯλΛ ฦ͢ͱɺϝιουΛՃͯ͠ ϢʔβͷίʔυյΕͳ͍ https://go.dev/play/p/SyXc7O9fIY4
Slide 25
Slide 25 text
ΠϯλʔϑΣΠεΛฦ͢σϝϦοτ 25 w ελΠϧ͕+BWBʹΑͬͯ͠·͏Մೳੑ w JOUFSGBDFͷํ͕TUSVDUΑΓϝϞϦΛ͏
Slide 26
Slide 26 text
ΠϯλʔϑΣΠεͷ͓·͡ͳ͍ 26 (PͷΠϯλʔϑΣΠε+BWBͷΑ͏ʹɺJNQMFNFOUT Λ໌ࣔ͠ͳ͍ɻ ҎԼͷ͓·͡ͳ͍Λॻ͘͜ͱͰಉ༷ͷറΓ͕Մೳɻ
Slide 27
Slide 27 text
ΠϯλʔϑΣΠεͷ͓·͡ͳ͍ ͓·͡ͳ͍Λ͚ͭΔͱɺstruct͕interfaceͷৼΔ͍ Λຬͨ͞ͳ͍ͱ͖ʹɺӈͷΑ͏ʹίϯύΠϧΤϥʔʹ ͳΔɻ https://go.dev/play/p/XQOUPM481UF interfaceΛฦ͢߹ಛʹҙຯ͕ͳ͍
Slide 28
Slide 28 text
ΠϯλʔϑΣΠεͷ͓·͡ͳ͍ structΛฦ͢߹ɺ ͓·͡ͳ͍Λ͚ͭΔ͜ͱͰ interfaceͷৼΔ͍Λຬͨ͞ͳ͍ͱ͖ʹɺίϯύΠϧ ΤϥʔʹͰ͖Δɻ͓·͡ͳ͍͕ͳ͍ͱɺΤϥʔʹͳΒ ͳ͍ɻ https://go.dev/play/p/yeoIy9tt9MY
Slide 29
Slide 29 text
݁ہͲͬͪΛฦ͖͔͢ interfaceΛฦ͢ͱӈਤͷΑ͏ʹ ґଘ͕ൃੜ͢ΔͷͰɺॊೈ͞ΛٻΊΔ ͷͰ͋ΕɺstructΛฦ͢ํ͕͍͍
Slide 30
Slide 30 text
5*1 BOZԿ͑ͳ͍ 30
Slide 31
Slide 31 text
BOZͱ ۭΠϯλʔϑΣΠεJOUFSGBDF\^ͷΤΠϦΞε
Slide 32
Slide 32 text
BOZͱ ͲΜͳܕͰอ࣋Ͱ͖Δ ˠաͳҰൠԽ ɹ੩తܕ͚ݴޠͷར͕ࣦΘΕΔ
Slide 33
Slide 33 text
BOZͱ ϝιουͷγάχνϟͰ͖Δ͚ͩ໌ࣔతʹ͢Δ BOZԿͷใ࣋ͨͳ͍ͷͰ جຊతʹΘͳ͍
Slide 34
Slide 34 text
BOZΛ͏͖ͱ͖ ϚʔγϟϧؔͳͲ͋ΒΏΔܕΛ ड͚औͬͨΓฦͨ͠Γ͢Δඞཁ͕͋Δͱ͖
Slide 35
Slide 35 text
BOZΛ͏͖ͱ͖ https://pkg.go.dev/encoding/json#Marshal encoding/jsonͷMarshal
Slide 36
Slide 36 text
BOZΛ͏͖ͱ͖ database/sqlͷQueryContext https://pkg.go.dev/database/sql#DB.QueryContext SELECT * FROM FOO WHERE id = ?
Slide 37
Slide 37 text
5*1 δΣωϦΫε 37
Slide 38
Slide 38 text
δΣωϦΫεΛ༻͠ͳ͍ྫ ࠨͷίʔυmapܕ͔ΒΩʔΛશͯग़ྗ͢Δɻ Go Plagyround
Slide 39
Slide 39 text
δΣωϦΫεΛ༻͠ͳ͍ྫ NͷΩʔͱ͕ଞͷܕͰ͋ͬͨ߹ʹ ಈ͔ͳ͘ͳΔɻ ࠨN͕NBQTUSJOHʹͳͬͨͷͰ ίϯύΠϧΤϥʔ
Slide 40
Slide 40 text
BOZͰ࣮ͨ͠ྫ HFU,FZTɺBOZΛड͚ͱΓɺBOZΛฦ͢ɻ Go Playground
Slide 41
Slide 41 text
BOZͰ࣮ͨ͠ྫ HFU,FZTɺBOZΛड͚ͱΓɺBOZΛฦ͢ɻ (Pͷ੩తܕ͚ͷར͕ࣦΘΕΔ ܁Γฦ͠ͷίʔυ͕૿͑ΔՄೳੑ ˠ%3:ݪଇʹ͢Δ
Slide 42
Slide 42 text
DPNQBSBUJWFͰ࣮ͨ͠ྫ ΠϯλʔϑΣΠεಉ༷BOZʹΑΔແବͳநԽආ͚Δ͖ NBQͰɺWBSNNBQ<<>CZUF>JOUͷΑ͏ʹ LFZʹεϥΠεΛऔΔ͜ͱͰ͖ͳ͍ɻ
Slide 43
Slide 43 text
DPNQBSBUJWFͰ࣮ͨ͠ྫ 5DPNQBSBCMFͱɺΈࠐΈͷΠϯλʔϑΣΠεɻ 5DPNQBSBCMFͰൺֱՄೳͳͷΈҾʹड͚औΔ͜ͱ͕ՄೳʹͳΔɻ
Slide 44
Slide 44 text
DPNQBSBUJWFͰ࣮ͨ͠ྫ BOZܕͷΘΓʹDPNQBSBCMFΛ༻͍Δ https://go.dev/play/p/ENyS1GKu3IU
Slide 45
Slide 45 text
ಠࣗͷܕ੍Λఆٛ͢Δ https://go.dev/play/p/VHKfcvYQNua VOJPOTΛ༻͍Δͱ ΠϯλʔϑΣΠεͰಠࣗͷܕ੍Λ ఆٛ͢Δ͜ͱ͕Ͱ͖Δ
Slide 46
Slide 46 text
VOJPOTͱ ෳͷܕΛड͚औΕΔΑ͏ʹͰ͖Δ
Slide 47
Slide 47 text
ಠࣗͷܕ੍Λఆٛ͢Δ VOJPOTΛؚΉΠϯλϑΣʔεܕ੍Ͱ͔͑͠ͳ͍ɻ WBSYDVTUPN$POTUSBJOUͷΑ͏ʹͰ͖ͳ͍ɻ
Slide 48
Slide 48 text
δΣωϦΫεͷҙ ϝιουͰ༻Ͱ͖ͳ͍ɻ ؔՄೳ
Slide 49
Slide 49 text
δΣωϦΫεͷҙ TUSVDUͰ༻Ͱ͖Δɻ
Slide 50
Slide 50 text
δΣωϦΫεͷҙ ࠨɺಠࣗͷܕ੍ΛTUSVDUʹ࣋ͨͤͨྫ (P1MBZHPSVOE
Slide 51
Slide 51 text
δΣωϦΫεͷҙ JOUFSGBDFʹTUSDVUΛFNCFEͰ͖Δ ͔͠͠ɺϑΟʔϧυʹΞΫηεͰ͖ͳ͍ɻ
Slide 52
Slide 52 text
δΣωϦΫεͷҙ ͜ΕίϯύΠϧΤϥʔ
Slide 53
Slide 53 text
δΣωϦΫεͷҙ δΣωϦΫε͋͘·Ͱܕ੍ͷΈɻ ࣮ࡍʹϑΟʔϧυʹΞΫηε͢Δ͜ͱͰ͖ͳ͍ɻ
Slide 54
Slide 54 text
dJOUWTJOU dJOUJOUΛϕʔεͱ͢ΔܕΛશͯड͚औΕΔ https://go.dev/play/p/E3kcU9-7TJ6
Slide 55
Slide 55 text
δΣωϦΫεΛ༻͖͢ͱ͖ w σʔλߏ FHόΠφϦπϦʔɺ࿈݁Ϧετɺώʔϓ w εϥΠεɺϚοϓɺ͓ΑͼҙͷλΠϓͷνϟωϧͰಈ࡞͢Δؔ w δΣωϦΫεΛͬͯৼΔ͍ΛநԽ͢Δ
Slide 56
Slide 56 text
εϥΠεɺϚοϓɺ͓ΑͼҙͷλΠϓͷνϟωϧͰಈ࡞͢Δؔ δΣωϦΫεΛ༻͖͢ͱ͖
Slide 57
Slide 57 text
δΣωϦΫεΛͬͯৼΔ͍ΛநԽ͢Δ δΣωϦΫεΛ༻͖͢ͱ͖
Slide 58
Slide 58 text
δΣωϦΫεΛ༻͖͢Ͱͳ͍ͱ͖ w ड͚औͬͨҾͷϝιουΛ༻͢Δͱ͖ w δΣωϦΫεΛ͏͜ͱͰίʔυ͕ෳࡶʹͳΔͱ͖ (Pͷ։ൃऀؒδΣωϦΫεͳ͠Ͱ͖ͬͯͨ
Slide 59
Slide 59 text
δΣωϦΫεΛ༻͖͢Ͱͳ͍ͱ͖ ड͚औͬͨҾͷϝιουΛ༻͢Δͱ͖ͷྫ
Slide 60
Slide 60 text
5*1 ܕͷຒΊࠐΈ 60
Slide 61
Slide 61 text
TUSVDUͷ&NCFEEJOH &NCFEEJOHͷઆ໌ࣗମ5JQͰղઆ͠·ͨ͠ͷͰ ͦͪΒͷεϥΠυΛࢀর͍ͯͩ͘͠͞ɻ https://speakerdeck.com/tomo1227/goyan-yu-100tips-no-dot-1-5-matome?slide=91
Slide 62
Slide 62 text
TUSVDUͷ&NCFEEJOH ࠶ܝ 4USVDUʹTUSVDUΛFNCFE 62
Slide 63
Slide 63 text
ܕͷຒΊࠐΈ w ϑΟʔϧυͷΞΫηεΛ؆୯ʹ͢ΔͨΊͷγϯλοΫεγϡΨʔͱ͠ ͯɺ༻ͯ͠ͳΒͳ͍ɻʢ 'PP#BS#B[ ͷΘΓʹ 'PP#B[ ͳͲʣ ͜Ε͕།ҰͷࠜڌͰ͋Δ߹ɺ෦ͷܕΛຒΊࠐ·ͣɺΘΓʹϑΟ ʔϧυΛ͏ w ֎෦͔ΒӅṭ͍ͨ͠σʔλৼΔ͍ΛϓϩϞʔτ͍͚ͯ͠ͳ͍ɻ ߏମͷඇެ։Ͱ͋Δ͖ϩοΫಈ࡞ʹΫϥΠΞϯτ͕ΞΫηεͰ͖ ΔΑ͏ʹ͢Δ߹ͳͲ 63
Slide 64
Slide 64 text
ܕͷຒΊࠐΈͷ 64 Ұݟӈͷίʔυͷํ͕ݟ͘͢ྑͦ͞͏͕ͩɺ͍͚ͬͯͳ͍μϝͳྫ ❌ ⭕
Slide 65
Slide 65 text
ܕͷຒΊࠐΈͷ 65 ͠ɺެ։͞ΕͨΠϯλʔϑΣΠεʹIncϝ ιουΛؚΉ߹ʹɺΫϥΠΞϯτ͔Β Lock()Unlock()͕ݟ͑ͯ͠·͏
Slide 66
Slide 66 text
ܕͷຒΊࠐΈͷ 66 ಉ໊͡લͷϑΟʔϧυ͕ଘࡏ͢Δͱ͖ɺFNCFEEJOHΛ ߦ͏ͱͲͷϑΟʔϧυʹΞΫηε͍ͯ͠Δͷ͔͕ ͔Γʹ͘͘ͳΔɻ
Slide 67
Slide 67 text
ܕͷຒΊࠐΈ 67 ͲͪΒΫϥΠΞϯτ͔ΒݟΔͱɺ 8SJUF $MPTFS Λެ։͍ͯ͠Δ͜ͱʹ มΘΒͳ͍ˠແବͳίʔυΛݮΒͤΔ
Slide 68
Slide 68 text
·ͱΊ w ܕຒΊࠐΈɺϘΠϥʔϓϨʔτίʔυ ݴޠ্༷ল͘ࣄ͕Ͱ͖ ͳ͍ఆܕతͳίʔυ Λճආ͢Δͷʹཱͭ w ެ։͢ΔͨΊ͚ͩʹߦ͍ɺӅ͞ΕΔ͖ཁૉΛϓϩϞʔτ͠ͳ͍ Α͏ʹ͢Δ