メルカリ社員100人に聞いたGoLandの使い方 / JetBrains Night Tokyo 2018

メルカリ社員100人に聞いたGoLandの使い方 / JetBrains Night Tokyo 2018

0e797080b64e6b03ed00964cf69b5058?s=128

Masahiro Wakame

November 20, 2018
Tweet

Transcript

  1. ϝϧΧϦࣾһ100ਓʹ ฉ͍ͨGoLandͷ࢖͍ํ JetBrains Night Tokyo 2018 Θ͔Ί ·͞ͻΖ

  2. Θ͔Ί ·͞ͻΖ @v vakame Masahiro Wakame Go GraphQL TypeScript

  3. Q. ຊ౰ʹ100ਓʹฉ͍ͨʁ

  4. Q. ຊ౰ʹ100ਓʹฉ͍ͨʁ

  5. Q. ຊ౰ʹ100ਓʹฉ͍ͨʁ ड़΂ਓ਺ 372ਓ ʹ ฉ͖·ͨ͠ʂʂ

  6. ࠓ೔ͷαϚϦ ΈΜͳʹฉ͍ͨ ूେ੒Λ࿩͠·͢ʂ

  7. ࠓ೔ͷαϚϦ •GoLand ཱࣗɾࣗशͷͨΊͷ࢓૊Έ •IDEʹٻΊΔػೳ •GoLandͷศརͳػೳͨͪ

  8. ֤OSຖͷ࿩ •๻͸macOSϢʔβͰ͢ •ࠓ೔͸جຊmacOSϕʔε •Action໊͕Θ͔Ε͹OK •͋ͱͰઆ໌͠·͢

  9. ཱࣗɾࣗशͷͨΊͷ࢓૊Έ

  10. GoLand͸ଟػೳͰ͋Δ •ػೳ͕ແݶʹ͋Δ •஌Βͳ͍ػೳ͸࢖͏͜ͱ͕Ͱ͖ͳ͍ •Ͳ͏΍ͬͯڧ͘ͳΕ͹͍͍Μͩ… ·ͣ͸ษڧͷ࢓ํ͔Β

  11. Productivity Guide •௚༁͢Δͱੜ࢈ੑΨΠυ •Help > Productivity Guide •ීஈ࢖ͬͯͳ͍ػೳʹ஫໨ •ਓͷΛݟΔͱ݁ߏָ͍͠

  12. Find Action •ActionΛ୳͢ •Help > Find Action •ࠓ೔͜Ε͚ͩ͸֮͑ͯؼͬͯʂ •͍͍ͩͨͷ΋ͷ͕Action Cmd+Shift+A

  13. Find Action ͍͍ͩͨ Կ΋͔΋ Actionͩʂ

  14. Find Action ຊࢿྉ΋ Action໊Λ ໌ه͠·͢

  15. Search Everywhere •ͳΜͰ΋ݕࡧ • ͜Ε •ϑΝΠϧ, ܕ, Action ͳʹ΋͔΋͔Βݕࡧ Shift

    Shift ࠔͬͨΒShift࿈ଧϚϯ
  16. Preferencesͷݕࡧ •ݕࡧܥػೳ΄Μͱॆ࣮͍ͯ͠Δ

  17. ϖΞ ϓϩάϥϛϯά •Ұ൪ϕʔγοΫͳ΍ͭ •ਫ਼ਆతෑډ͸ͪΐͬͱߴ͍ •Ҋ֎ΈΜͳ࢖͍ํ͕όϥ͚Δ •γϣϧμʔαʔϑΟϯ͢Δͷָ͕ ڐՄ͸औΖ͏ʂ

  18. Tip of the Day •ศར৘ใΛϥϯμϜʹදࣔ •Help > Tip of the

    Day •Ұؾʹෳ਺ݟΔͱָ͍͠ •গͣͭ͠ڧ͘ͳΖ͏ʂ
  19. Presentation Assistant (Plugin) • github.com/chashnikov/IntelliJ-presentation- assistant • γϣʔτΧοτΩʔදࣔϓϥάΠϯ Unofficial PluginͰ͢

  20. Key Promotor X (Plugin) • github.com/halirutan/IntelliJ-Key-Promoter-X • γϣʔτΧοτΩʔڭҭϓϥάΠϯ • Ϛ΢εͱ͔࢖͏ͱࢦಋ͞ΕΔ

    Unofficial PluginͰ͢
  21. •Preference > Keymap > γϣʔτΧοτٯҾ͖ ਓ͔ΒڭΘΔ࣌ศར ͻͬͦΓͯ͠·͢

  22. খ͍͞Ϙλϯશ෦ԡ͢ •݁ߏݟಀ͚͢Ͳਵॴʹ͋Δ ͱΓ͋͑ͣԡ͠·͠ΐ͏

  23. ෆຬΛݟಀ͞ͳ͍ •ෆศʹ׳Εͳ͍΄͏͕Α͍ •ղফͯ͠৐Γӽ͍͖͍͑ͯͨ •ݴ͏͸қ͘ߦ͏͸೉͠… ୳ͤ͹(͍͍ͩͨ)͋Δʂ

  24. ϒϩάͱ͔ݟΔ •blog.jetbrains.com/go/ •blog.jetbrains.com/jp/category/goland •samuraism.com/jetbrains/training ࡢ೔ϓογϡ͞ΕͨͷͰ…(ૉ௚

  25. IDEʹٻΊΔػೳ

  26. Goͷύοέʔδ؅ཧ •܈༤ׂڌ •Dep •Go Modules (Official) •↑Experimental GoLand͸Go Modulesαϙʔτࡁ

  27. Go Modules •GO111MODULE=on •࠷ߴͷαϙʔτʂ ͜Εͦ͜ސ٬͕ٻΊ͍ͯͨ΋ͷ…ʂ

  28. Go Module •GoLandͷGo Moduleαϙʔτ࠷ߴ(࠶ܝ •$GOPATH ͷมͳpackageरΘͳ͍ •↑ͪΐ͍ͪΐ͍ਏ͔ͬͨ… •IDEͱͯ͠ͷ׬੒౓͕͕͋ͬͨ(ؾʹͳΔ

  29. σόοΨ •ී௨ʹ࢖͑Δ (Delve͕backend •Break point / Inspector •Unit TestपΓͷαϙʔτ΋ॆ࣮ •Ͱ͖ͳ͍…

    •ෳࡶͳEvaluate Expression / Set Value
  30. AppEngineαϙʔτ •Google Cloud PlatformͷAppEngine •࢖ͬͯ·͔͢ʁ࢖ͬͯ·͢Ͷʁ •go111 runtimeͰΊͬͪΌָʹͳͬͨ •AppEngineଆ͕าΈد͖ͬͯͨܗ •2018.3 Ͱچruntimeͷαϙʔτ΋վળ

    ΊͬͪΌ࿩͍͚ͨ͠Ͳधཁബͦ͏ͳͷͰ࠙਌ձͰ…
  31. ίʔυิ׬ •ී௨ͷαδΣετ •ςετੜ੒ •Struct ͷFieldຒΊ •etc…

  32. πʔϧྨ…ʁ •gofmt, goimportsͳͲ •αϙʔτ༗Γ •νʔϜͰ౷Ұ͢ΔͨΊಛఆͷΤσΟλʹ ґଘͨ͘͠ͳ͍ؾ࣋ͪ΋… •gometalinter → File Watcher

  33. ଞΤσΟλϢʔβʹฉ͍ͨ

  34. Vim •IdeaVim Plugin •ΠέΔ೿ •ͭΒ͍೿ •Undoͷڍಈ͕ਏ͍… plugins.jetbrains.com/plugin/164-ideavim

  35. ίʔυิ׬ͱ͔͍Δͷ೿ ݾΛ஁͑Ε͹ Α͘ͳ͍Ͱ͔͢ʁ ※ݸਓͷײ૝Ͱ͢(ͬͯݴ͑ͬͯ

  36. GoLandͷศརͳػೳͨͪ ৭ʑग़͖ͯ·ͨ͠

  37. Show Intention Action •ͦͷ࣌ศརͦ͏ͳΞΫγϣϯΛදࣔ •Կ͔͋Γͦ͏ͱࢥͬͨΒͱΓ͋͑ͣԡ͢ •Quick Fix ʹ͍ۙ •Warning΍Error͕ͳͯ͘΋ԡͤΔ Option

    + Enter
  38. Test (Cmd+Shift+T) •Code ⇔ Test ͷҠಈ •Testͷੜ੒ •Table Driven TestͳςϯϓϨΛੜ੒ʂ

    •ςετؔ਺໊΋ΘΓͱྑ͍ Table Driven Testͯ͠·͔͢ʁ
  39. Fill struct recursively •஋ͱͯ͠struct࡞Δ࣌ʹศར •zero஋ͰҰ୴શ෦ຒΊͯ͘ΕΔ Testॻ࣌͘ʹΑ͘࢖͍·͢

  40. Mark Directory as •Excludes ͱ͔͢Δ •ݕࡧͱ͔ʹҾ͔͔ͬΒͳ͘ͳΔ ͿͬͪΌ͚͋Μ·࢖Θͳ͍

  41. Declaration •ఆٛʹඈͿ΍ͭ •͜ͷϝιουͷ࣮૷Ͳ͏ͳͬͯΔͷʙ •Jump to Source ͱҧ͍͕Θ͔Βͳ͍… •GoҎ֎ͷݴޠͩͱҧ͏ͷ͔ͳ ͍ͭτϥοΫύουͰૢ࡞͢Δ΍ͭ

  42. Back •1ݸલͷ৔ॴʹ໭Δ΍ͭ •Declarationͱ૊Έ߹Θͤͯසൟʹ࢖͏ •๻͸࠷ۙ·Ͱ஌Βͳͯ͘ෆศͩͱࢥͬͯ ·ͨ͠…

  43. Next Project Window •ผ૭Ͱ։͍͍ͯΔProjectʹҠಈ͢Δ΍ͭ •ɹ͔ͨ͠ʹ •͔ɺ͔͍͍ͬ͜…

  44. Edit Custom VM Options •GoLandͷىಈΦϓγϣϯ͍͡ΕΔ •-XmxΛ૿΍͢ʂͱ͍͏ਓ͕ଟ͔ͬͨ •JVMͷ࠷େώʔϓαΠζ •๻͸ -Xmx1920m ʹ͠·ͨ͠

  45. Recent Files •Recent Edited Files ΋͋ΔΑʂ

  46. •͜ͷInterfaceΛ࣮૷ͯ͠Δ΍ͭͲ͍ͭʁ •Methodͷ࣮૷ͷҰཡͱ͔΋ग़ͤΔ Implementations ݁ߏසൟʹ࢖͏…ʂΊͬͪΌྑ͍

  47. Call Hierarchy •ؔ਺ͳͲͷݺͼग़͠πϦʔΛදࣔ •Find Usage ΑΓศར…ʂ •࠶ؼతʹḷΕΔ Find Usageͣͬͱ࢖ͬͯͨ…

  48. Scratch File •GoͰ΋ී௨ʹ࢖͑Δ •ಉ྅ͱίʔυͷ૬ஊ͍ͨ͠… •Playground → ิ׬ͳͯ͘ࢮ͵ •Scratch FileͰॻ͍ͯShare͢Δ ৽نϫʔΫεϖʔε४උ͸ΊΜͲ͍

  49. JetBrains Toolbox •www.jetbrains.com/toolbox/ •GoLand ͦͷଞIDEೖΕΔͷΒ͘Β͘ •όʔδϣϯݻఆͱ͔΋Ͱ͖Δ •Ξϓσ΋ϥΫϥΫʂ Actionͱ͔Ͱ͸ͳ͍͚Ͳ…

  50. Implement Interface •͋Δstructͱ͔ʹඞཁͳϝιουΛ ͼΌͬʂͱੜ΍ͤΔ ๻͸ implement missing method ೿Ͱ͢

  51. Implements missing method •଍Γͳ͍ϝιουΛͼΌͬʂͱੜ΍ͤΔ ίϯύΠϥʹinterface࣮૷νΣοΫͤ͞ΒΕΔ

  52. File… :Line:Column •File Ͱ :ߦ൪߸:ྻ൪߸ Ͱ֘౰Ґஔʹඈ΂Δ σόοάָ͕ʂ

  53. Next Highlighted Error •Warning, Error etc ʹδϟϯϓͰ͖Δ •ίϯύΠϧΤϥʔͷमਖ਼࣌ʹศར

  54. Show tabs in one row •Preferences > Editor > General

    > Editor Tabs •Show tabs in one row Λ disable ʹ͢Δ •λϒද͕ࣔ1ߦʹͳΔͷෆศͩΑͶ… •શ෦ݟ͑ͯΔͱ޾ͤ
  55. Camel Case matching •ೖྗิ׬Ͱ໊લΛશ෦ଧͭඞཁ͸ͳ͍ •େจࣈ෦෼͚ͩͱ͔Ұ෦෼͚ͩͰOK ͜͏͍͏໊લͷ΍ͭ͋ͬͨΑͳ…ʁ Ͱίʔυ͕ॻ͚·͢(υΩϡϝϯτ͸ಡ΋͏

  56. Quick Documentation •υΩϡϝϯτ͕γϡοͱݟΕ·͢ •External Documentation΋͋ΔΑʂ •godocͷWebϖʔδ͕γϡοͱ։͘

  57. Find in Path •ϓϩδΣΫτશମݕࡧͱ͔ •Τϥʔϝοηʔδ͔ΒൃੜՕॴௐ΂ͨΓ •Replace in Path ΋Α͘࢖͍·͢

  58. ࠷ޙʹ

  59. We are hiring! •͞ΒͳΔ৘ใ͸ࣾ಺Wiki΍SlackͰʂ •ΞΫηε͢Δʹ͸ೖࣾ͢Δ͔͠ͳ͍…ʂ •ϝϧΧϦˠ careers.mercari.com/ •ϝϧϖΠˠ jp.merpay.com/careers/

  60. None