SlideShare a Scribd company logo
@JFrog | jfrog.com | #GoCenter
Refactoring to modules
Why, How and Everything Else
@JFrog | jfrog.com | #GoCenter
Who am I?
•DevOps Consultant
•Full-stack software engineer
• Tackling everything from
DevOps and Backend challenges
to the latest Frontend frameworks
Elad Hirsch , DevOps Consultant
@JFrog | jfrog.com | #GoCenter
FROGS - THE LIQUID SOFTWARE COMPANY
@JFrog | jfrog.com | #GoCenter
@JFrog | jfrog.com | #GoCenter
GoCenter
Xray
JFrog CLI
Metadata server
Replicator
E+ Platform Installer
We absolutely love Go and we use it a lot
@JFrog | jfrog.com | #GoCenter
Let’s travel back in time…
@JFrog | jfrog.com | #GoCenter
When did you start with Go?
Let’s turn to the audience for a poll…
1.0
2012
1.2
2013
1.5
2015
1.8
2017
1.11
2018
@JFrog | jfrog.com | #GoCenter
A quick history of go
Go 1.0
First major
milestone as a
long term
stable release
2012 2015
Go 1.5
First release to
no longer use C
(except for cgo)
2017
Go 1.8
Introduction of
Go plugins
2018
Go 1.11
This is where
the magic is! (at
least for this
talk ☺)
@JFrog | jfrog.com | #GoCenter
Dependency Management…
So what is that magic?
@JFrog | jfrog.com | #GoCenter
“Tis impossible to be sure of anything
but Death and Taxes”
- Christopher Bullock
@JFrog | jfrog.com | #GoCenter
Let’s start with the why…
@JFrog | jfrog.com | #GoCenter
Why do we have
this problem?
@JFrog | jfrog.com | #GoCenter
GO origins
@JFrog | jfrog.com | #GoCenter
Dependency management @ Google
•One Huge Makefile
•Refactor into multi Makefile per module
•Pain of dependency management is huge this days
Dependency Hell term
is born
@JFrog | jfrog.com | #GoCenter
Let’s do something very simple
@JFrog | jfrog.com | #GoCenter
One easy solution…?
Dependencies are sources!
Remote imports are in VCS
Dump everything into a single folder
Compile everything together
Profit!!
@JFrog | jfrog.com | #GoCenter
•Which dependencies I use?
•Which dependencies you used?
•Which dependencies I should use?
•Which code I’m editing right now?
•Is there any dependency duplications?
•What is going on?!
Wait ! But… how do I know…
@JFrog | jfrog.com | #GoCenter
The official response - Let’s duplicate dependencies
“Check your dependencies to your own VCS.”
Andrew Gerrand
@JFrog | jfrog.com | #GoCenter
Vendoring – the worst kind of forking
“Copyall of the filesat some version from one version control repository and
pastethem into a differentversion control repository”
@JFrog | jfrog.com | #GoCenter
• History, branch, and tag information is lost
(metadata is lost)
• Pulling updates is impossible
• It invites modification, divergence, and bad
fork
• It wastes space
• Good luck finding which version of the code
you using
But what is wrong with vendoring?
@JFrog | jfrog.com | #GoCenter
Build your own dependency manager…
“It’s not the role of the tooling provided by
the language to dictate how you manage
your code (...)”
Andrew Gerrand
@JFrog | jfrog.com | #GoCenter
The community steps in
AND THE NEXT THING YOU KNOW…
THERE ARE 19 DEPENDENCY MANAGERS
Refactoring to GO modules
@JFrog | jfrog.com | #GoCenter
•Working in project directories
•Local cache for dependencies
•Version declarations
•Conflict resolution
Go dep – Proper dependency management?
•Started as an experiment
•Lesson learned from - java / npm …
•Main challenge - how to solve conflict resolution
• Dep disallow multiple major versions
• GO Tech lead Russ Cox took another approach
• Go -> Simple solution -> SMV
Go dep status
Refactoring to GO modules
Refactoring to GO modules
Refactoring to GO modules
@JFrog | jfrog.com | #GoCenter
Let’s actually go fix it!
GO Modules
@JFrog | jfrog.com | #GoCenter
Who is using Go modules?
Let’s turn to the audience for another poll…
Yes No
@JFrog | jfrog.com | #GoCenter
Module
A module is a collection of
related Go packages that
are versioned together as a
single unit.
Let’s go over some definitions
@JFrog | jfrog.com | #GoCenter
Sources
A module is a tree
(directory) of Go source
files with a go.mod file in
the root directory.
Let’s go over some definitions
@JFrog | jfrog.com | #GoCenter
Version Control
Most often, a single
version-control repository
corresponds exactly to a
single module
Let’s go over some definitions
@JFrog | jfrog.com | #GoCenter
Set the environment variable
GO111MODULE to ON
you do not need to set
GO111MODULE
Using go modules
1
2
Work inside $GOPATH Work outside $GOPATH
@JFrog | jfrog.com | #GoCenter
mkdir mymodule
cd mymodule
go mod init github.com/retgits/mymodule
Creating a module
@JFrog | jfrog.com | #GoCenter
•Import dependencies from Gopkg.lock
go mod init <module path>
•Remove unnecessary imports and add indirect imports
go mod tidy
•Delete the vendor folder
rm –rf vendor/
•Delete Gopkg files
rm Gopkg.*
Moving from DEP to modules
Upgrade from dep to go modules
git clone https://github.com/eladh/sample-app-go-dep.git
@JFrog | jfrog.com | #GoCenter
module github.com/retgits/mymodule
go 1.12
require (
github.com/naoina/go-stringutil v0.1.0
github.com/some/dependency v1.2.3
github.com/google/go-github/v25 v25.0.1
)
replace github.com/some/dependency github.com/retgits/dependency
Versioning
@JFrog | jfrog.com | #GoCenter
@JFrog | jfrog.com | #GoCenter
module github.com/retgits/mymodule
go 1.12
require (
github.com/naoina/go-stringutil v0.1.0
github.com/some/dependency v1.2.3
github.com/google/go-github/v25 v25.0.1
)
replace github.com/some/dependency github.com/retgits/dependency
Replacing packages
@JFrog | jfrog.com | #GoCenter
module github.com/retgits/mymodule
go 1.12
require (
github.com/naoina/go-stringutil v0.1.0
github.com/some/dependency v1.2.3
github.com/google/go-github/v25 v25.0.1
)
replace github.com/some/dependency ../../Downloads/dependency
It’s great when you got dependencies
that still under local development
@JFrog | jfrog.com | #GoCenter
•You can create the vendor folder
go mod vendor
•You can use the vendor folder during builds
go build –mod=vendor
This does mean you need to have all dependencies
listed in your go.mod file
But I kinda like the vendor folder?
It’s provide us dependencies beforehand
@JFrog | jfrog.com | #GoCenter
Before modules
go get https://github.com/sirupsen/logrus
git clone https://github.com/sirupsen/logrus
<build module locally>
With modules
go get github.com/sirupsen/logrus
GET github.com/sirupsen/logrus/@v/list
GET github.com/sirupsen/logrus/@v/v1.0.0.mod
GET github.com/sirupsen/logrus/@v/v1.0.0.zip
Go get my a new super duper module
@JFrog | jfrog.com | #GoCenter
Houston… I think I lost my module?
@JFrog | jfrog.com | #GoCenter
The <module>@v<version> construct should be immutable
That means that
github.com/retgits/checkiday/@v/v1.0.0
Should forever be the same…
Modules are immutable
@JFrog | jfrog.com | #GoCenter
But are they really?
”Friends don’t let friends do git push -f”
- Aaron Schlesinger
@JFrog | jfrog.com | #GoCenter
Using the GOPROXY variable
export GOPROXY=https://myawesomeproxy.com
go get github.com/retgits/checkiday
@JFrog | jfrog.com | #GoCenter
A Go module proxy is any web server that can
respond to GET requests for URLs of a specified form.
The requests have no query parameters, so even a
site serving from a fixed file system (including a
file:/// URL) can be a module proxy.
@JFrog | jfrog.com | #GoCenter
Keeping modules
Highly available, CDN, no infra, free
Public cache (public proxy)
Immediate access, not shared, can be wiped…
Local cache ($GOPATH/pkg/mod)
Fast access, requires infra, shared across devs
Organizational cache (private proxy)
@JFrog | jfrog.com | #GoCenter
And also faster builds…
Let’s check public proxy performance
Refactoring to GO modules
@JFrog | jfrog.com | #GoCenter
@JFrog | jfrog.com | #GoCenter
What is a 5* module for you?
How can we ensure module quality ?
@JFrog | jfrog.com | #GoCenter
•If you haven’t, start with Go modules:
GO111MODULE=on if you must stay on $GOPATH
•Start working outside of your $GOPATH
•Use a public proxy server for immutable Go modules
(like GoCenter.io)
•Think about running your own proxy server or repository
manager such as Artifactory or Athens
Final thoughts
@JFrog | jfrog.com | #GoCenter
Go modules are in beta stage ?
Modules are supported from Go version 1.11
but it will be finalized in Go version 1.13
@JFrog | jfrog.com | #GoCenter
@JFrog | jfrog.com | #GoCenter
There’s one more thing…
But before I go…
@JFrog | jfrog.com | #GoCenter
Promo - 100NIS_less
@JFrog | jfrog.com | #GoCenter
Thank you!
@JFrog | jfrog.com | #GoCenter
▪
JFrog CLI
// Configure Artifactory:
jfrog rt c
//Configure the project's repositories::
jfrog rt go-config
//Build the project with go and resolve the project dependencies from
Artifactory.
jfrog rt go build --build-name=my-build --build-number=1
//Publish the package we build to Artifactory.
jfrog rt gp go v1.0.0 --build-name=my-build --build-number=1
//Collect environment variables and add them to the build info.
jfrog rt bce my-build 1
//Publish the build info to Artifactory.
jfrog rt bp my-build 1
JFrog CLI - GO support

More Related Content

PDF
Modern Web 2016: Using Golang to build a smart IM Bot
PDF
Git workflow in agile development
PDF
COSCUP 2016: Project 52 每週一個小專案來學習 Golang
PDF
Project52
PPTX
Introduction to GoLang
PDF
Developing for LinkedIn's Application Platform
PDF
iTHome Gopher Day 2017: What can Golang do? (Using project 52 as examples)
PPT
OSGi Versioning & Testing
Modern Web 2016: Using Golang to build a smart IM Bot
Git workflow in agile development
COSCUP 2016: Project 52 每週一個小專案來學習 Golang
Project52
Introduction to GoLang
Developing for LinkedIn's Application Platform
iTHome Gopher Day 2017: What can Golang do? (Using project 52 as examples)
OSGi Versioning & Testing

What's hot (20)

PDF
History and Development of OpenJDK
PDF
Gerrit Code Review
PDF
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
PDF
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
PDF
Collaborative Development: The Only CD That Matters - Brent Beer - Codemotion...
PDF
Getting started with Go - Florin Patan - Codemotion Rome 2017
PDF
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
PDF
Golang taipei #45 10th birthday
PDF
Collaborative development with git
ODP
Deploying Joomla sites with GIT
PDF
GoLang Introduction
PDF
RESTful API Development using Go
PDF
Distributed Versioning Tools, BeJUG 2010
PDF
Introduction to Go
PDF
Coding with golang
PDF
State Of Zope Linuxtag 2008
PDF
CI/CD: Lessons from LinkedIn and Mockito
PDF
Building Command Line Tools with Golang
PPTX
The development workflow of git github for beginners
PDF
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
History and Development of OpenJDK
Gerrit Code Review
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
Collaborative Development: The Only CD That Matters - Brent Beer - Codemotion...
Getting started with Go - Florin Patan - Codemotion Rome 2017
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
Golang taipei #45 10th birthday
Collaborative development with git
Deploying Joomla sites with GIT
GoLang Introduction
RESTful API Development using Go
Distributed Versioning Tools, BeJUG 2010
Introduction to Go
Coding with golang
State Of Zope Linuxtag 2008
CI/CD: Lessons from LinkedIn and Mockito
Building Command Line Tools with Golang
The development workflow of git github for beginners
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Ad

Similar to Refactoring to GO modules (20)

PDF
Building a Kubernetes Powered Central Go Modules Repository
PDF
Refactoring to Modules - Why, How and Everything Else I Can Fit In 45 Minutes…
PDF
Refactoring to Modules - Why, How and Everything Else I Can Fit In 45 Minutes…
PDF
Cloud native - CI/CD
PDF
How to plan and define your CI-CD pipeline
PPTX
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
PDF
Refactoring to Go modules: why and how
PPTX
Introduction to git & github
PDF
Advantages of golang development services &amp; 10 most used go frameworks
PDF
Artifactory Essentials Workshop on August 27, 2020 by JFrog
PDF
Trusting Your Ingredients - What Building Software And Cheesecake Have In Common
PDF
Where did my modules GO? Building and deploying Go Apps w/ GoCenter & Codefresh
PPTX
Write microservice in golang
PDF
Best practices for joomla extensions developers
PPT
Unit Test for ZF SlideShare Component
ODP
Build and Deploy a Python Web App to Amazon in 30 Mins
PDF
So You Just Inherited a $Legacy Application...
PPTX
Introduction to go lang
PPTX
Que nos espera a los ALM Dudes para el 2013?
PDF
Griffon for the Enterprise
Building a Kubernetes Powered Central Go Modules Repository
Refactoring to Modules - Why, How and Everything Else I Can Fit In 45 Minutes…
Refactoring to Modules - Why, How and Everything Else I Can Fit In 45 Minutes…
Cloud native - CI/CD
How to plan and define your CI-CD pipeline
Modernisation of legacy PHP applications using Symfony2 - PHP Northeast Confe...
Refactoring to Go modules: why and how
Introduction to git & github
Advantages of golang development services &amp; 10 most used go frameworks
Artifactory Essentials Workshop on August 27, 2020 by JFrog
Trusting Your Ingredients - What Building Software And Cheesecake Have In Common
Where did my modules GO? Building and deploying Go Apps w/ GoCenter & Codefresh
Write microservice in golang
Best practices for joomla extensions developers
Unit Test for ZF SlideShare Component
Build and Deploy a Python Web App to Amazon in 30 Mins
So You Just Inherited a $Legacy Application...
Introduction to go lang
Que nos espera a los ALM Dudes para el 2013?
Griffon for the Enterprise
Ad

More from Elad Hirsch (10)

PDF
Data in the wild west with some DevOps to the rescue
PPTX
Intro to kubernetes
PDF
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
PPTX
JaVers (Open Source) - Object auditing and diff framework
PDF
So you want to write a cloud function
PDF
Migrate AngularJS to Angular (v5)
PPTX
devjam2018 - angular 5 performance
PPT
Jenkins 17 IL - JavaScript CI/CD
PPTX
AngularJS - Architecture decisions in a large project 
PPTX
Jenkins 1
Data in the wild west with some DevOps to the rescue
Intro to kubernetes
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
JaVers (Open Source) - Object auditing and diff framework
So you want to write a cloud function
Migrate AngularJS to Angular (v5)
devjam2018 - angular 5 performance
Jenkins 17 IL - JavaScript CI/CD
AngularJS - Architecture decisions in a large project 
Jenkins 1

Recently uploaded (20)

PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Transform Your Business with a Software ERP System
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
history of c programming in notes for students .pptx
PDF
System and Network Administraation Chapter 3
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Design an Analysis of Algorithms II-SECS-1021-03
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
How to Migrate SBCGlobal Email to Yahoo Easily
Transform Your Business with a Software ERP System
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PTS Company Brochure 2025 (1).pdf.......
Odoo POS Development Services by CandidRoot Solutions
Upgrade and Innovation Strategies for SAP ERP Customers
history of c programming in notes for students .pptx
System and Network Administraation Chapter 3
Which alternative to Crystal Reports is best for small or large businesses.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Wondershare Filmora 15 Crack With Activation Key [2025
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Design an Analysis of Algorithms II-SECS-1021-03

Refactoring to GO modules

  • 1. @JFrog | jfrog.com | #GoCenter Refactoring to modules Why, How and Everything Else
  • 2. @JFrog | jfrog.com | #GoCenter Who am I? •DevOps Consultant •Full-stack software engineer • Tackling everything from DevOps and Backend challenges to the latest Frontend frameworks Elad Hirsch , DevOps Consultant
  • 3. @JFrog | jfrog.com | #GoCenter FROGS - THE LIQUID SOFTWARE COMPANY
  • 4. @JFrog | jfrog.com | #GoCenter
  • 5. @JFrog | jfrog.com | #GoCenter GoCenter Xray JFrog CLI Metadata server Replicator E+ Platform Installer We absolutely love Go and we use it a lot
  • 6. @JFrog | jfrog.com | #GoCenter Let’s travel back in time…
  • 7. @JFrog | jfrog.com | #GoCenter When did you start with Go? Let’s turn to the audience for a poll… 1.0 2012 1.2 2013 1.5 2015 1.8 2017 1.11 2018
  • 8. @JFrog | jfrog.com | #GoCenter A quick history of go Go 1.0 First major milestone as a long term stable release 2012 2015 Go 1.5 First release to no longer use C (except for cgo) 2017 Go 1.8 Introduction of Go plugins 2018 Go 1.11 This is where the magic is! (at least for this talk ☺)
  • 9. @JFrog | jfrog.com | #GoCenter Dependency Management… So what is that magic?
  • 10. @JFrog | jfrog.com | #GoCenter “Tis impossible to be sure of anything but Death and Taxes” - Christopher Bullock
  • 11. @JFrog | jfrog.com | #GoCenter Let’s start with the why…
  • 12. @JFrog | jfrog.com | #GoCenter Why do we have this problem?
  • 13. @JFrog | jfrog.com | #GoCenter GO origins
  • 14. @JFrog | jfrog.com | #GoCenter Dependency management @ Google •One Huge Makefile •Refactor into multi Makefile per module •Pain of dependency management is huge this days Dependency Hell term is born
  • 15. @JFrog | jfrog.com | #GoCenter Let’s do something very simple
  • 16. @JFrog | jfrog.com | #GoCenter One easy solution…? Dependencies are sources! Remote imports are in VCS Dump everything into a single folder Compile everything together Profit!!
  • 17. @JFrog | jfrog.com | #GoCenter •Which dependencies I use? •Which dependencies you used? •Which dependencies I should use? •Which code I’m editing right now? •Is there any dependency duplications? •What is going on?! Wait ! But… how do I know…
  • 18. @JFrog | jfrog.com | #GoCenter The official response - Let’s duplicate dependencies “Check your dependencies to your own VCS.” Andrew Gerrand
  • 19. @JFrog | jfrog.com | #GoCenter Vendoring – the worst kind of forking “Copyall of the filesat some version from one version control repository and pastethem into a differentversion control repository”
  • 20. @JFrog | jfrog.com | #GoCenter • History, branch, and tag information is lost (metadata is lost) • Pulling updates is impossible • It invites modification, divergence, and bad fork • It wastes space • Good luck finding which version of the code you using But what is wrong with vendoring?
  • 21. @JFrog | jfrog.com | #GoCenter Build your own dependency manager… “It’s not the role of the tooling provided by the language to dictate how you manage your code (...)” Andrew Gerrand
  • 22. @JFrog | jfrog.com | #GoCenter The community steps in
  • 23. AND THE NEXT THING YOU KNOW… THERE ARE 19 DEPENDENCY MANAGERS
  • 25. @JFrog | jfrog.com | #GoCenter •Working in project directories •Local cache for dependencies •Version declarations •Conflict resolution Go dep – Proper dependency management?
  • 26. •Started as an experiment •Lesson learned from - java / npm … •Main challenge - how to solve conflict resolution • Dep disallow multiple major versions • GO Tech lead Russ Cox took another approach • Go -> Simple solution -> SMV Go dep status
  • 30. @JFrog | jfrog.com | #GoCenter Let’s actually go fix it!
  • 32. @JFrog | jfrog.com | #GoCenter Who is using Go modules? Let’s turn to the audience for another poll… Yes No
  • 33. @JFrog | jfrog.com | #GoCenter Module A module is a collection of related Go packages that are versioned together as a single unit. Let’s go over some definitions
  • 34. @JFrog | jfrog.com | #GoCenter Sources A module is a tree (directory) of Go source files with a go.mod file in the root directory. Let’s go over some definitions
  • 35. @JFrog | jfrog.com | #GoCenter Version Control Most often, a single version-control repository corresponds exactly to a single module Let’s go over some definitions
  • 36. @JFrog | jfrog.com | #GoCenter Set the environment variable GO111MODULE to ON you do not need to set GO111MODULE Using go modules 1 2 Work inside $GOPATH Work outside $GOPATH
  • 37. @JFrog | jfrog.com | #GoCenter mkdir mymodule cd mymodule go mod init github.com/retgits/mymodule Creating a module
  • 38. @JFrog | jfrog.com | #GoCenter •Import dependencies from Gopkg.lock go mod init <module path> •Remove unnecessary imports and add indirect imports go mod tidy •Delete the vendor folder rm –rf vendor/ •Delete Gopkg files rm Gopkg.* Moving from DEP to modules
  • 39. Upgrade from dep to go modules git clone https://github.com/eladh/sample-app-go-dep.git
  • 40. @JFrog | jfrog.com | #GoCenter module github.com/retgits/mymodule go 1.12 require ( github.com/naoina/go-stringutil v0.1.0 github.com/some/dependency v1.2.3 github.com/google/go-github/v25 v25.0.1 ) replace github.com/some/dependency github.com/retgits/dependency Versioning
  • 41. @JFrog | jfrog.com | #GoCenter
  • 42. @JFrog | jfrog.com | #GoCenter module github.com/retgits/mymodule go 1.12 require ( github.com/naoina/go-stringutil v0.1.0 github.com/some/dependency v1.2.3 github.com/google/go-github/v25 v25.0.1 ) replace github.com/some/dependency github.com/retgits/dependency Replacing packages
  • 43. @JFrog | jfrog.com | #GoCenter module github.com/retgits/mymodule go 1.12 require ( github.com/naoina/go-stringutil v0.1.0 github.com/some/dependency v1.2.3 github.com/google/go-github/v25 v25.0.1 ) replace github.com/some/dependency ../../Downloads/dependency It’s great when you got dependencies that still under local development
  • 44. @JFrog | jfrog.com | #GoCenter •You can create the vendor folder go mod vendor •You can use the vendor folder during builds go build –mod=vendor This does mean you need to have all dependencies listed in your go.mod file But I kinda like the vendor folder? It’s provide us dependencies beforehand
  • 45. @JFrog | jfrog.com | #GoCenter Before modules go get https://github.com/sirupsen/logrus git clone https://github.com/sirupsen/logrus <build module locally> With modules go get github.com/sirupsen/logrus GET github.com/sirupsen/logrus/@v/list GET github.com/sirupsen/logrus/@v/v1.0.0.mod GET github.com/sirupsen/logrus/@v/v1.0.0.zip Go get my a new super duper module
  • 46. @JFrog | jfrog.com | #GoCenter Houston… I think I lost my module?
  • 47. @JFrog | jfrog.com | #GoCenter The <module>@v<version> construct should be immutable That means that github.com/retgits/checkiday/@v/v1.0.0 Should forever be the same… Modules are immutable
  • 48. @JFrog | jfrog.com | #GoCenter But are they really? ”Friends don’t let friends do git push -f” - Aaron Schlesinger
  • 49. @JFrog | jfrog.com | #GoCenter Using the GOPROXY variable export GOPROXY=https://myawesomeproxy.com go get github.com/retgits/checkiday
  • 50. @JFrog | jfrog.com | #GoCenter A Go module proxy is any web server that can respond to GET requests for URLs of a specified form. The requests have no query parameters, so even a site serving from a fixed file system (including a file:/// URL) can be a module proxy.
  • 51. @JFrog | jfrog.com | #GoCenter Keeping modules Highly available, CDN, no infra, free Public cache (public proxy) Immediate access, not shared, can be wiped… Local cache ($GOPATH/pkg/mod) Fast access, requires infra, shared across devs Organizational cache (private proxy)
  • 52. @JFrog | jfrog.com | #GoCenter And also faster builds…
  • 53. Let’s check public proxy performance
  • 55. @JFrog | jfrog.com | #GoCenter
  • 56. @JFrog | jfrog.com | #GoCenter What is a 5* module for you? How can we ensure module quality ?
  • 57. @JFrog | jfrog.com | #GoCenter •If you haven’t, start with Go modules: GO111MODULE=on if you must stay on $GOPATH •Start working outside of your $GOPATH •Use a public proxy server for immutable Go modules (like GoCenter.io) •Think about running your own proxy server or repository manager such as Artifactory or Athens Final thoughts
  • 58. @JFrog | jfrog.com | #GoCenter Go modules are in beta stage ? Modules are supported from Go version 1.11 but it will be finalized in Go version 1.13
  • 59. @JFrog | jfrog.com | #GoCenter
  • 60. @JFrog | jfrog.com | #GoCenter There’s one more thing… But before I go…
  • 61. @JFrog | jfrog.com | #GoCenter Promo - 100NIS_less
  • 62. @JFrog | jfrog.com | #GoCenter Thank you!
  • 63. @JFrog | jfrog.com | #GoCenter ▪ JFrog CLI // Configure Artifactory: jfrog rt c //Configure the project's repositories:: jfrog rt go-config //Build the project with go and resolve the project dependencies from Artifactory. jfrog rt go build --build-name=my-build --build-number=1 //Publish the package we build to Artifactory. jfrog rt gp go v1.0.0 --build-name=my-build --build-number=1 //Collect environment variables and add them to the build info. jfrog rt bce my-build 1 //Publish the build info to Artifactory. jfrog rt bp my-build 1 JFrog CLI - GO support