SlideShare a Scribd company logo
Hurry Up and Go
(But Not Too Fast)
Stuart Fettinger
sfettinger@nvisia.com
About Me
Project Architect at NVISIA
10+ years of experience designing, developing, and delivering solutions
Recent co-founder of a tech startup
Passionate about limiting tech debt through clean and efficient design
Topic Breakdown
Brief Introduction to GO
Guiding Principles and Core Concepts
Go’s strong (and not so strong) suits
Highlighting when GO is a preferred choice, and when it’s not,
through real-world examples
Designing a GO Microservice
Tips for your design to take advantage of Go to its fullest and avoid
common pitfalls
What is GoLang?
• Developed by Google in 2007
• Designed to overcome criticism
of other languages
•Statically typed and compiled
• Syntactically similar to C
Go’s Guiding
Principles
Simplicity
Type inference
Declare-and-initialize operations
No generics
Composition rather than inheritance
Readability
As little “magic” as possible
Explicit and lean error mechanisms
Orthogonality
Do one thing well, keep things simple, standardize communication
Elimination of cross-linking complexity
Performance
Built in garbage collection
Synchronization, channels and Go routines
Pointers
A Basic Example
Main package – compiled binary
Short, concise imports
Function keywords
Multiple return values
Meaningful spaces – no semicolons
Core Concepts
Packages provide logical groupings and reusable functionality
Every Go program starts in the main package’s main() function
Main package is compiled to binary
Functions beginning with a capital letter are exported outside their package
Functions beginning with a lowercase letter are essentially private
Packages
Introduction to GoLang
Functions are stand-alone pieces of functionality
Methods are functions with receivers - tied to a type
Methods should be used when state is important and with interfaces
Rule of thumb – prefer methods over functions
Methods vs. Functions
Introduction to GoLang
Variables that store the memory address of other variables
Zero type of nil – popularly used where nil is valid and relied upon
Memory address available via &
Pointer dereferenced via *
Pointers
Introduction to GoLang
Introduction to GoLang
Structs
Named collections of fields
When initialized, all fields are set to their zero values
Fields of a struct are accessed via “.” operator
Composition over inheritance – one struct cannot be the child of another
Structs can contain other structs
Introduction to GoLang
Named collections of method signatures
No “Implements” keyword – can be implemented directly by implementing all methods
Interfaces can be empty – automatically satisfied by any type
Go’s answer to polymorphism
Interfaces
Introduction to GoLang
Errors
Errors are treated as values
Stack traces don’t come for free with errors
Idiomatic to check for errors frequently via “if” operations
No try/catch framework – error handling up to developers
Introduction to GoLang
Go Routines
Lightweight threads managed by the Go runtime
Spawned by simply using “go” keyword
Initially small stack size with ability to scale
Leverage channels to pass messages, block, and sync between Go routines
Performant – can run thousands of Go routines at a time with little drag
Introduction to GoLang
What Go Doesn’t Have
• Inheritance
• Classes
• Exceptions
• Generics
Deciding When to
Use Go
Go Is Not One-Size Fits All
• Go works well in some cases, not so great in others
• Some scenarios to consider Go
• Small, predictable routines
• Where performance margins are razor thin (ie: trading)
• Quick start-up with limited resources
• Scaling is a prime factor or an unknown
• Concurrency and communication is a prime use-case
• Scenarios where Go may fall short
• Where complexity requires extensive third-party libraries
• Where OO reduces complexity
• Front-end MVC
• Team makeup is less experienced
• Remember – design decisions should be case-by-case – try not to promote blanket use of technology
Considerations
• What are the requirements for the problem I am trying to solve?
• Can I solve the problem another way, and will doing so lose me any benefits?
• Consider technical pros and cons, but also intangible factors
• Developer happiness
• Community support
• Framework maturity
• Current trends
• Consider supporting a solution after it is live
• Scaling needs
• Technical debt and BAU maintenance
Use Case #1
Requirements
• Microservice with capabilities to
• Store high resolution images on the cloud
• Resize images without damaging resolution
• Be available on-demand to fetch data
• Data throughput may be larger than other streams (ie: text)
As a user, I want to be able to upload a high-resolution image, and retrieve it later in
whatever dimensions I want, so that I can use the image for different situations
Use Case #1
Performance exceeds
that of an interpreted
language
Package manager and
libraries are more
diverse
Higher scalability to
meet unknown data
demands
Ease of using docker to
spin up containers
Serverless architecture
support
Further developed
community
Smaller learning curve
for front-end
developers
Channels and
GoRoutines to spread
out workloads
Use Case #2
Requirements
• Several microservices connecting with different resources and providing different outputs
• Similarities in data may be a high percentage of make-up
• Data has potential to be large – multi-threading may be important
As a user, I want to be able to call APIs for different but similar data, and aggregate them
together, so that I can streamline my usage of that data
Use Case #2
Lightweight syntax –
avoid getting lost in
complex data
manipulation
Inheritance and
genericsHigh Performance
Mature libraries for
persistence and data
combination
Go Channels and Go
Routines – automate
polling data
Extensive API strategy
support
Use Case #3
Requirements
• Many file types may exist in many different formats
• Files may be made available at different times
• Must store data, potentially in a variety of formats
As a user, I want to be able to ingest and persist files from many different sources, so that I
can scrape the data later via my own processes
Use Case #3
Significant performance
benefits
Mature ORM libraries
Low learning curve
Wide database support
Higher developer
popularity
Multithreading
capabilities
Use Case #4
Requirements
• Application available on the web, potentially mobile as well
• Rich Interface and modern design
• Communicates with various microservices
• Possibilities are endless – login, registration, alerts, etc…
As a developer, I want to create a front-end web application for my users to interact with,
so that I can expand my customer base
Use Case #4
Lower learning curve Mature MVVM patterns
and support
Templating and
rendering engines
High number of built-in
must-haves for front-
end development
Third-party routing
support
Seamless integration
with a back-end Go
stack (Revel)
Designing a GO
Microservice - Tips
Don’t Reinvent
the Wheel#1
Plenty of third-party
frameworks exist to
ease microservice
development
GoMicro
• Foundation for RPC and event-driven communication with reasonable defaults built in
• Out-of-the-box:
• Service discovery
• Auto registration and name resolution
• Load Balancing
• Even distribution and node-retry
• Message Encoding
• Proto-RPC and Json-RPC by default
• Asynchronous
• Event-driven architecture
• “Pluggable” interfaces
• Platform agnostic implementations
GoKit
• Toolkit for Go – designed to be imported into a binary package
• Fills the gaps left by the base package(s)
• Security
• Monitoring
• Service Discovery
• Can be thought of as similar to
• Spring Boot
• Eureka
• Ribbon
• Integrates well with Docker, Kubernetes, and Heroku
• Different from GoMicro in that it’s more of a toolkit, less of a platform
Leverage
Interfaces#2
Interfaces provide
portable, independent
implementation
opportunities
• Expose interfaces as contracts between services
• Centralize common features such as logging and queueing
• Allow platform-agnostic implementations
• ie: data layer interfaces and repositories
ORM is Your
Friend#3
Make your entities
more meaningful by
tying them to an ORM
implementation
Go’s lean syntax drives you to use straight SQL prepared statements
• Gets messy fast with many parameters and outputs
• Nil considerations are difficult – Go values not easily nillable
• Compiler will not catch issues with prepared statements, field names, etc...
GoRM
• Provides associations between entities – Has One, Has Many, Many to
Many, Belongs To, etc…
• Uses any field with ID as the primary key – no need to annotate
• Auto support for creation, update, and soft-delete timestamps
• Auto-update capabilities – No need to explicitly call update vs insert
• Provides hooks to execute functionality pre or post running SQL
• API for transaction management and rollback
• Eager loading vs lazy loading (default) capabilities
• Can run raw SQL if needed
Centralize
configurations#4
Go’s binary nature may drive you to place configs in files within the application, or
on the server in a central location
• It works – but you’re missing out
Create a central location where configurations live – ideally another microservice
serving up files
• Place security on top of configs
• Integrate with CI/CD pipelines
• Inject configs via use of Docker secrets, etc…
• Leverage caching for failure scenarios
Read configurations into your services by leveraging Go-based configuration
solutions
Viper
• API to find and load config files of varying formats
• Also supports writing configuration files
• Provides defaults and gracefully handles overrides
• Live-watching of configs, and hot-reloading
• Alias-based naming, allowing non-breaking renames
• Uses environment variables to manage different configurations
• Remote key/value store support
Centralized
configuration keeps
things DRY
Make Errors
Meaningful#5
• Errors are values so it’s easy to treat them as strings and just pass them up the
chain
• There is no stacktrace included with an error by default
• There is no concept of an exception in Go – up to the developer to handle
• Implement the error interface to construct meaningful errors of different types
• Add stack trace information by using go-errors package
• Add important logging info using go log flags
Supplement your error
framework with
additional logging and
packages
When Designing Your Microservices…
• Understand the cases where your chosen technology works best
• Do POCs, reach out to the community, benchmark test – make informed decisions based on use cases
• Don’t be afraid to mix and match to get your desired result
• i.e – Go, third-party Go packages, Spring, Docker, etc…
• Always look for opportunities to improve, but not to the point of development paralysis
• Go is meant to be simple – don’t head down the rabbit hole of over-inventiveness
• Don’t invite unnecessary technical debt
• Consider your long-term goals and scaling needs when deciding how to implement functionality
• Design for technical soundness but also developer satisfaction
• Go is so popular, in part, because it’s fun
Questions

More Related Content

What's hot (20)

PDF
GoLang Introduction
Spandana Govindgari
 
PDF
Concurrency With Go
John-Alan Simmons
 
PPTX
Go Language presentation
Gh-Mohammed Eldadah
 
PDF
The Go programming language - Intro by MyLittleAdventure
mylittleadventure
 
PPSX
Golang getting started
Harshad Patil
 
PPTX
Go Programming language, golang
Basil N G
 
PPT
Rust Programming Language
Jaeju Kim
 
PDF
Go Concurrency
jgrahamc
 
PDF
Why you should care about Go (Golang)
Aaron Schlesinger
 
PDF
Goroutines and Channels in practice
Guilherme Garnier
 
PDF
Introduction to go language programming
Mahmoud Masih Tehrani
 
PPTX
golang_getting_started.pptx
Guy Komari
 
PPT
GO programming language
tung vu
 
PDF
Concurrency in Golang
Oliver N
 
PPTX
Memory in go
Iman Tunggono
 
PDF
SANS Forensics 2009 - Memory Forensics and Registry Analysis
mooyix
 
PDF
Rust system programming language
robin_sy
 
PPT
Introduction to Go programming
Exotel
 
PPTX
Fuzzing
Khalegh Salehi
 
PPTX
Introduction to Apache Spark
Rahul Jain
 
GoLang Introduction
Spandana Govindgari
 
Concurrency With Go
John-Alan Simmons
 
Go Language presentation
Gh-Mohammed Eldadah
 
The Go programming language - Intro by MyLittleAdventure
mylittleadventure
 
Golang getting started
Harshad Patil
 
Go Programming language, golang
Basil N G
 
Rust Programming Language
Jaeju Kim
 
Go Concurrency
jgrahamc
 
Why you should care about Go (Golang)
Aaron Schlesinger
 
Goroutines and Channels in practice
Guilherme Garnier
 
Introduction to go language programming
Mahmoud Masih Tehrani
 
golang_getting_started.pptx
Guy Komari
 
GO programming language
tung vu
 
Concurrency in Golang
Oliver N
 
Memory in go
Iman Tunggono
 
SANS Forensics 2009 - Memory Forensics and Registry Analysis
mooyix
 
Rust system programming language
robin_sy
 
Introduction to Go programming
Exotel
 
Introduction to Apache Spark
Rahul Jain
 

Similar to Introduction to GoLang (20)

PDF
Model-driven and low-code development for event-based systems | Bobby Calderw...
HostedbyConfluent
 
PDF
20160422 Speedy Framework Enterprise Application Development Platform
Harezmi IT Solutions
 
PPTX
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
Phil Wilkins
 
PDF
Forging a New Path to Equitable Justice – Platform Engineering for State Gove...
Chris Wahl
 
PPTX
Comparing Legacy and Modern e-commerce solutions
Mike Ensor
 
PDF
Manatee to Dolphin: Transitioning to a Startup Mentality
Todd Kaplinger
 
PPTX
Making software development processes to work for you
Ambientia
 
PPTX
Community day 2013 applied architectures
Panagiotis Kefalidis
 
PDF
How to Migrate from .NET to Drupal
Acquia
 
PDF
Agents for SW development - Berkeley LLM AI Agents MOOC
VincentLui15
 
PDF
resume4
James Black
 
PDF
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
confluent
 
PPTX
Web frameworks
Arafat Hossan
 
PPTX
SF Architect Interview questions v1.3.pptx
AnkitJain429819
 
PDF
Agile Software Development
Ahmet Bulut
 
PDF
Meetup. Technologies Intro for Non-Tech People
IT Arena
 
PPTX
Software Design
Ahmed Misbah
 
PDF
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
confluent
 
PPTX
Web development tips and tricks
maxo_64
 
PDF
How to guarantee your change is integrated to Moodle core
Dan Poltawski
 
Model-driven and low-code development for event-based systems | Bobby Calderw...
HostedbyConfluent
 
20160422 Speedy Framework Enterprise Application Development Platform
Harezmi IT Solutions
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
Phil Wilkins
 
Forging a New Path to Equitable Justice – Platform Engineering for State Gove...
Chris Wahl
 
Comparing Legacy and Modern e-commerce solutions
Mike Ensor
 
Manatee to Dolphin: Transitioning to a Startup Mentality
Todd Kaplinger
 
Making software development processes to work for you
Ambientia
 
Community day 2013 applied architectures
Panagiotis Kefalidis
 
How to Migrate from .NET to Drupal
Acquia
 
Agents for SW development - Berkeley LLM AI Agents MOOC
VincentLui15
 
resume4
James Black
 
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
confluent
 
Web frameworks
Arafat Hossan
 
SF Architect Interview questions v1.3.pptx
AnkitJain429819
 
Agile Software Development
Ahmet Bulut
 
Meetup. Technologies Intro for Non-Tech People
IT Arena
 
Software Design
Ahmed Misbah
 
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
confluent
 
Web development tips and tricks
maxo_64
 
How to guarantee your change is integrated to Moodle core
Dan Poltawski
 
Ad

More from NVISIA (16)

PPTX
The Evolution of Architecture
NVISIA
 
PDF
Expected Result - A UX Story
NVISIA
 
PPTX
Antifragile Teams
NVISIA
 
PPTX
Digital Operations Service Design
NVISIA
 
PPTX
Executive Briefing: The Why, What, and Where of Containers
NVISIA
 
PDF
Strengthening Business/IT Relationships
NVISIA
 
PPTX
Achieving Business Alignment
NVISIA
 
PPTX
Intro to AWS Machine Learning
NVISIA
 
PPTX
2015 DevOps Breakfast - DevOps in Action
NVISIA
 
PDF
DAMA Chicago - Ensuring your data lake doesn’t become a data swamp
NVISIA
 
PPTX
Scaling the Lean Startup in the Enterprise
NVISIA
 
PPTX
INNOVATION BLUEPRINTS FOR BIMODAL IT
NVISIA
 
PPTX
Building a Data Talent Pipeline in Southeaster Wisconsin
NVISIA
 
PPTX
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
NVISIA
 
PPTX
Big Data 2.0 - Milwaukee Big Data User Group Presentation
NVISIA
 
PPTX
NVISIA Mobile Trends Presentation
NVISIA
 
The Evolution of Architecture
NVISIA
 
Expected Result - A UX Story
NVISIA
 
Antifragile Teams
NVISIA
 
Digital Operations Service Design
NVISIA
 
Executive Briefing: The Why, What, and Where of Containers
NVISIA
 
Strengthening Business/IT Relationships
NVISIA
 
Achieving Business Alignment
NVISIA
 
Intro to AWS Machine Learning
NVISIA
 
2015 DevOps Breakfast - DevOps in Action
NVISIA
 
DAMA Chicago - Ensuring your data lake doesn’t become a data swamp
NVISIA
 
Scaling the Lean Startup in the Enterprise
NVISIA
 
INNOVATION BLUEPRINTS FOR BIMODAL IT
NVISIA
 
Building a Data Talent Pipeline in Southeaster Wisconsin
NVISIA
 
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
NVISIA
 
Big Data 2.0 - Milwaukee Big Data User Group Presentation
NVISIA
 
NVISIA Mobile Trends Presentation
NVISIA
 
Ad

Recently uploaded (20)

PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PPTX
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
Human Resources Information System (HRIS)
Amity University, Patna
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 

Introduction to GoLang

  • 1. Hurry Up and Go (But Not Too Fast) Stuart Fettinger [email protected]
  • 2. About Me Project Architect at NVISIA 10+ years of experience designing, developing, and delivering solutions Recent co-founder of a tech startup Passionate about limiting tech debt through clean and efficient design
  • 3. Topic Breakdown Brief Introduction to GO Guiding Principles and Core Concepts Go’s strong (and not so strong) suits Highlighting when GO is a preferred choice, and when it’s not, through real-world examples Designing a GO Microservice Tips for your design to take advantage of Go to its fullest and avoid common pitfalls
  • 5. • Developed by Google in 2007 • Designed to overcome criticism of other languages •Statically typed and compiled • Syntactically similar to C
  • 6. Go’s Guiding Principles Simplicity Type inference Declare-and-initialize operations No generics Composition rather than inheritance Readability As little “magic” as possible Explicit and lean error mechanisms Orthogonality Do one thing well, keep things simple, standardize communication Elimination of cross-linking complexity Performance Built in garbage collection Synchronization, channels and Go routines Pointers
  • 7. A Basic Example Main package – compiled binary Short, concise imports Function keywords Multiple return values Meaningful spaces – no semicolons
  • 9. Packages provide logical groupings and reusable functionality Every Go program starts in the main package’s main() function Main package is compiled to binary Functions beginning with a capital letter are exported outside their package Functions beginning with a lowercase letter are essentially private Packages
  • 11. Functions are stand-alone pieces of functionality Methods are functions with receivers - tied to a type Methods should be used when state is important and with interfaces Rule of thumb – prefer methods over functions Methods vs. Functions
  • 13. Variables that store the memory address of other variables Zero type of nil – popularly used where nil is valid and relied upon Memory address available via & Pointer dereferenced via * Pointers
  • 16. Structs Named collections of fields When initialized, all fields are set to their zero values Fields of a struct are accessed via “.” operator Composition over inheritance – one struct cannot be the child of another Structs can contain other structs
  • 18. Named collections of method signatures No “Implements” keyword – can be implemented directly by implementing all methods Interfaces can be empty – automatically satisfied by any type Go’s answer to polymorphism Interfaces
  • 20. Errors Errors are treated as values Stack traces don’t come for free with errors Idiomatic to check for errors frequently via “if” operations No try/catch framework – error handling up to developers
  • 22. Go Routines Lightweight threads managed by the Go runtime Spawned by simply using “go” keyword Initially small stack size with ability to scale Leverage channels to pass messages, block, and sync between Go routines Performant – can run thousands of Go routines at a time with little drag
  • 24. What Go Doesn’t Have • Inheritance • Classes • Exceptions • Generics
  • 26. Go Is Not One-Size Fits All • Go works well in some cases, not so great in others • Some scenarios to consider Go • Small, predictable routines • Where performance margins are razor thin (ie: trading) • Quick start-up with limited resources • Scaling is a prime factor or an unknown • Concurrency and communication is a prime use-case • Scenarios where Go may fall short • Where complexity requires extensive third-party libraries • Where OO reduces complexity • Front-end MVC • Team makeup is less experienced • Remember – design decisions should be case-by-case – try not to promote blanket use of technology
  • 27. Considerations • What are the requirements for the problem I am trying to solve? • Can I solve the problem another way, and will doing so lose me any benefits? • Consider technical pros and cons, but also intangible factors • Developer happiness • Community support • Framework maturity • Current trends • Consider supporting a solution after it is live • Scaling needs • Technical debt and BAU maintenance
  • 28. Use Case #1 Requirements • Microservice with capabilities to • Store high resolution images on the cloud • Resize images without damaging resolution • Be available on-demand to fetch data • Data throughput may be larger than other streams (ie: text) As a user, I want to be able to upload a high-resolution image, and retrieve it later in whatever dimensions I want, so that I can use the image for different situations
  • 29. Use Case #1 Performance exceeds that of an interpreted language Package manager and libraries are more diverse Higher scalability to meet unknown data demands Ease of using docker to spin up containers Serverless architecture support Further developed community Smaller learning curve for front-end developers Channels and GoRoutines to spread out workloads
  • 30. Use Case #2 Requirements • Several microservices connecting with different resources and providing different outputs • Similarities in data may be a high percentage of make-up • Data has potential to be large – multi-threading may be important As a user, I want to be able to call APIs for different but similar data, and aggregate them together, so that I can streamline my usage of that data
  • 31. Use Case #2 Lightweight syntax – avoid getting lost in complex data manipulation Inheritance and genericsHigh Performance Mature libraries for persistence and data combination Go Channels and Go Routines – automate polling data Extensive API strategy support
  • 32. Use Case #3 Requirements • Many file types may exist in many different formats • Files may be made available at different times • Must store data, potentially in a variety of formats As a user, I want to be able to ingest and persist files from many different sources, so that I can scrape the data later via my own processes
  • 33. Use Case #3 Significant performance benefits Mature ORM libraries Low learning curve Wide database support Higher developer popularity Multithreading capabilities
  • 34. Use Case #4 Requirements • Application available on the web, potentially mobile as well • Rich Interface and modern design • Communicates with various microservices • Possibilities are endless – login, registration, alerts, etc… As a developer, I want to create a front-end web application for my users to interact with, so that I can expand my customer base
  • 35. Use Case #4 Lower learning curve Mature MVVM patterns and support Templating and rendering engines High number of built-in must-haves for front- end development Third-party routing support Seamless integration with a back-end Go stack (Revel)
  • 38. Plenty of third-party frameworks exist to ease microservice development GoMicro • Foundation for RPC and event-driven communication with reasonable defaults built in • Out-of-the-box: • Service discovery • Auto registration and name resolution • Load Balancing • Even distribution and node-retry • Message Encoding • Proto-RPC and Json-RPC by default • Asynchronous • Event-driven architecture • “Pluggable” interfaces • Platform agnostic implementations GoKit • Toolkit for Go – designed to be imported into a binary package • Fills the gaps left by the base package(s) • Security • Monitoring • Service Discovery • Can be thought of as similar to • Spring Boot • Eureka • Ribbon • Integrates well with Docker, Kubernetes, and Heroku • Different from GoMicro in that it’s more of a toolkit, less of a platform
  • 40. Interfaces provide portable, independent implementation opportunities • Expose interfaces as contracts between services • Centralize common features such as logging and queueing • Allow platform-agnostic implementations • ie: data layer interfaces and repositories
  • 42. Make your entities more meaningful by tying them to an ORM implementation Go’s lean syntax drives you to use straight SQL prepared statements • Gets messy fast with many parameters and outputs • Nil considerations are difficult – Go values not easily nillable • Compiler will not catch issues with prepared statements, field names, etc... GoRM • Provides associations between entities – Has One, Has Many, Many to Many, Belongs To, etc… • Uses any field with ID as the primary key – no need to annotate • Auto support for creation, update, and soft-delete timestamps • Auto-update capabilities – No need to explicitly call update vs insert • Provides hooks to execute functionality pre or post running SQL • API for transaction management and rollback • Eager loading vs lazy loading (default) capabilities • Can run raw SQL if needed
  • 44. Go’s binary nature may drive you to place configs in files within the application, or on the server in a central location • It works – but you’re missing out Create a central location where configurations live – ideally another microservice serving up files • Place security on top of configs • Integrate with CI/CD pipelines • Inject configs via use of Docker secrets, etc… • Leverage caching for failure scenarios Read configurations into your services by leveraging Go-based configuration solutions Viper • API to find and load config files of varying formats • Also supports writing configuration files • Provides defaults and gracefully handles overrides • Live-watching of configs, and hot-reloading • Alias-based naming, allowing non-breaking renames • Uses environment variables to manage different configurations • Remote key/value store support Centralized configuration keeps things DRY
  • 46. • Errors are values so it’s easy to treat them as strings and just pass them up the chain • There is no stacktrace included with an error by default • There is no concept of an exception in Go – up to the developer to handle • Implement the error interface to construct meaningful errors of different types • Add stack trace information by using go-errors package • Add important logging info using go log flags Supplement your error framework with additional logging and packages
  • 47. When Designing Your Microservices… • Understand the cases where your chosen technology works best • Do POCs, reach out to the community, benchmark test – make informed decisions based on use cases • Don’t be afraid to mix and match to get your desired result • i.e – Go, third-party Go packages, Spring, Docker, etc… • Always look for opportunities to improve, but not to the point of development paralysis • Go is meant to be simple – don’t head down the rabbit hole of over-inventiveness • Don’t invite unnecessary technical debt • Consider your long-term goals and scaling needs when deciding how to implement functionality • Design for technical soundness but also developer satisfaction • Go is so popular, in part, because it’s fun