Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Golang @ eureka

Golang @ eureka

04/11
実践Go言語勉強会〜サービス導入している3社がGo言語の魅力をお伝えします〜
https://atnd.org/events/75883

the use of Golang at eureka (including tips, architecture)

Tweet

More Decks by Masashi Salvador Mitsuzawa

Other Decks in Technology

Transcript

  1. about eureka - pairs - over 3,500,000 users - Japan

    & Taiwan 12೥9݄ 13೥3݄ 13೥9݄ 14೥3݄ 14೥9݄ 15೥3݄ 225ສ 135ສ 45ສ 90ສ 190ສ 3.5 year over 3,500,000
  2. about me - Masashi Salvador Mitsuzawa - Senior Engineer @

    eureka - Monetization Team Leader / Server Side Engineer Leader - Love #Curry #Haskell #Golang #Algorithm #MachineLearning - see : #ΧϨʔ৯͏ͨΊʹੜ͖ͯΔ @instagram - Twitter: @MasashiSalvador - Major : Computational Neuroscience @ Graduate School - 2013 - 2015 DeNA - 2015 - current eureka
  3. Outline • Why Go? • Architecture of pairs • Microservices

    • Structure of application • Libraries • Golang TIPS in pairs
  4. Outline • Why Go? • Architecture of pairs • Microservices

    • Structure of application • Libraries • Golang TIPS in pairs
  5. pairs: - About pairs Go Project - Over 1 year

    project - Data migration (schema change) - Full-scratch the entire codebase - Background - huge tech debt (including design debt) - Monolith architecture - DB (unscalable / strange schema) - Tightly Coupled - Technical Challenge
  6. Why Go? - Minimum syntax (minimum Spec)
 - bundle with

    formatter - easy to learn - able to keep clean codebase - easy to read! (important : able to read all OSS code) - Static Typing - Safe - High Performance - Concurrency - goroutine / channel - Good Standard Libraries (net/http, database/sql)
  7. Why NOT Go? - No “Modern” Syntax - map /

    reduce - No Class syntax - No Exception - Less established Libraries and frameworks - WAF(gin? revel? beego? echo?) - testing - ORM
  8. But We love - new language - challenging - creating

    new standard - at the same time engineers’ growing up
  9. Outline • Why Go? • Architecture of pairs • Microservices

    • Structure of application • Libraries • Golang TIPS in pairs
  10. Microservices - Service Oriented Architecture (All written in Golang) -

    pairs.lv - admin - search - batch - payment - surveillance - Stack - gin(pairs.lv) / goji(payment) - Elasticsearch - MySQL - Redis(cache) / DynamoDB - Ansible(provision, build, deploy)
  11. Response Request Structure Controller Facade Service Repository Entity - Basically

    structured as MVC Libraries View URL routing JSON SPA AngularJS + TypeScript DB
  12. Response Request Structure Controller Facade Service Repository Entity - Basically

    structured as MVC Libraries View URL routing JSON SPA AngularJS + TypeScript DB Core Library
  13. Libraries - WAF - revel (previous) - gin (current) -

    DB migration - goose - ORM - xorm - testing - ginkgo (RSpec Like / previous) - Go standard + testify (current) - package vendoring - nuts (previous) - glide (current)
  14. Outline • Why Go? • Architecture of pairs • Microservices

    • Structure of application • Libraries • Golang TIPS in pairs
  15. go generate - handing with routing - gin default (from

    README.md) - how to handle with many routing and controllers?
  16. go generate - handing with routing - naively (like many

    WAFs) main.go config/route mapping URL -> controller - a way to realize it in Go generator/main.go routes/api_xxx_v1.tml api_yyy_v1.tml api_zzz_v1.tml Read Read app/main_gen.go routes_gen.go Generate
  17. package vendoring - nuts (previous) eure/eure-go cloned from repositories pinned

    commit-hash app.go go get github.com/eure/eure-go
 import “github.com/eure/eure-go/ vendor/_nuts/github.com/revel/revel" import
  18. ginkgo -> standard library - Why NOT ginkgo? - heavy

    - Rspec Syntax - JustBeforeEach, BeforeEach, JustBefore, Before - not like Golang - members’ unfamiliar with RSpec - Standard testing + testify
  19. Mines … - Default Values - Slice append - packaging

    (unfamiliar with LL lang users) - gophers love bare net/http too much :)