shizuoka.go #12の資料です
GoͰwebΞϓϦ࡞͍ͬͯΔ@polidogshizuoka.go #12
View Slide
ࣗݾհ• @polidog• tavii.com Inc.• PHPer, Symfony Japan User Group• Gotanda.goͷओ࠵ऀͰ͢
http://gotrip.jp
WordPress
GoͰ࡞Γ͢
ࠓ͢͜ͱ• GoΛ࠾༻ͨ͠ཧ༝• Goݴޠͷֶͼํ• ͬͯΔϥΠϒϥϦʹ͍ͭͯ• ΜͰΔͷͱ͜Ζ
ͳͥGoΛ͓͏ͱࢥͬͨͷ͔ʁ
GoΛ࠾༻ͨ͠ཧ༝• ͦ͏(αʔόඅ͍҆ͨ͘͠)• Gotanda.goͷओ࠵ऀͳͷʹGo͕·ͱʹॻ͚ͳ͍• PHP͡Όͳ͍ύϥμΠϜΛֶͼ͍ͨ• GoϒʔϜ͋Δؾ͕͢Δ
http://tech.mercari.com/entry/2017/07/13/103000
Goݴޠͷֶͼํ
ֶͼํ• Tour of Go• ຊΛಡΉ• ͱʹ͔͘ҰͭԿ͔࡞ͬͯΈΔ
https://github.com/polidog/go-itunes
GoͳਓPR͕Β͑Δ
https://github.com/polidog/go-itunes/pull/1
https://github.com/polidog/go-nowplaying
webΞϓϦͷͨΊͷࢿྉΛಡΉ• GoݴޠʹΑΔWebΞϓϦέʔγϣϯ։ൃ• https://astaxie.gitbooks.io/build-web-application-with-golang/content/ja/
͍ͬͯΔϥΠϒϥϦʹ͍ͭͯ
ϑϨʔϜϫʔΫͷબ
ϑϨʔϜϫʔΫ• Revel• martini• goji• echo• gin• chi
͍ͬͺ͍͋ΔͶ
chiΑͦ͞͏
chiͷಛ• ͍ܰ• ͍• net/httpͷޓੑ͋Δ• ֎෦ͷύοέʔδʹґଘ͠ͳ͍
Regex url parameters
Database(ORM)
৭ʑύοέʔδ͋ΔΑͶ• gorm• gorp• dbr• xorm• sqlx
http://pospome.hatenablog.com/entry/2017/02/18/172307
gorm͕ྑͦ͞͏
http://jinzhu.me/gorm/models.html#model-definition
http://jinzhu.me/gorm/associations.html
http://jinzhu.me/gorm/crud.html#preloading-eager-loading
https://github.com/jinzhu/gorm/issues/246
Memcache
https://github.com/bradfitz/gomemcache
ଞʹબࢶ͕ͳ͔ͬͨ
StructΛmecachedʹอଘ͍ͨ͠
StructΛγϦΞϥΠζͯ͠Ωϟογϡ͢Δ
http://twinbird-htn.hatenablog.com/entry/2017/01/01/181058
ύοέʔδཧ
ଞͷݴޠͩͱ• npm• gem• composer…etc
GoͰʁ
https://github.com/golang/go/wiki/PackageManagementTools
͍Ζ͍Ζ͋ΔͶ
ެ͔ࣜͩΒdep͓͏ʂ
dep init
ύοέʔδͷՃ
dep ensure -add ύοέʔδ໊
ʊਓਓਓਓਓਓਓਓਓʊʼɹpre-alpha stateɹʻʉY^Y^Y^Y^Y^Y^Y^Yʉ
ΜͰ͍Δͱ͜Ζ
σΟϨΫτϦߏ
ΠϯελϯεͷҾ͖ճ͠
Contextͷ͍ํ
࠷ޙʹ
GoΛͬͱॻ͚ΔΑ͏ʹͳΓ͍ͨ
Gotripྑ͍αʔϏεͳͷͰɺྑ͍ίʔυͰαʔϏεΛ͍ͤͨ͞
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ