Learning Golang: Dependencies, Modules and How to manage Packages

preview_player
Показать описание
Welcome! Let's learn about Go Modules!

* Module path: indicates how our package will be imported by our users, and
* Dependency Requirements, indicate the packages we depend on.

"Dependency Requirements" not only covers the actual packages but also ways to "Replace" or "Exclude" them, using the corresponding directives:

* Replace: allows replacing a version of a dependency with another one, for example in cases where local deployment is still happening or when working for forked versions; and
* Exclude: allows excluding a version of a dependency from use, for example in cases those versions include security issues or bugs.

"Go Modules" were introduced in Go 1.11 and enabled by default in Go 1.16, they use "Semantic Versioning" (SemVer) as the main versioning system, were versions are defined using three numbers: Major.Minor.Patch.

The Go toolchain allows interacting with Modules via the "mod" command, but not only that other commands like "get" or "build" are also compatible with Go Modules, the most used commands are:

* "go mod tidy" to remove unused dependencies.

---

Real life examples of versioning Go Modules:

Tools:

---

00:00 - Start
00:08 - What is a Go Module?
03:58 - Versioning Go Modules: Path or Branch
05:29 - Demo, go mod init
08:59 - Module upgrade and downgrade
13:18 - Requesting available updates
14:19 - Versioning: Real life examples
15:26 - Go Modules: Conclusion and parting words

---

Who am I:

Hello👋🏼! I'm Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I've learned while working for small startups and large companies including the processes I've followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and Systems Design!

Keep it up. Don't give up!

#golang #tutorial #programming

--- Our affiliate links below

--- Our Vlog Channel

Рекомендации по теме
Комментарии
Автор

thanks, it clarifies something I don't understand before.

ultiumlabs
Автор

Incredibly useful video ! Thanks for helping demystify something that turned out to be quite simple

MarcelloLins
Автор

thanks for the video! Very good explanation

TheAlissonX
Автор

Thank you. A lot of useful information and amazing way to explain things.

dmitrydmitriev
Автор

This is extremely useful! Thank you so much for the tutorial!

jasonjiang
Автор

Olá Mario tudo bem? Espero que sim.. falo aqui do Brasil, queria agradecer pelo conteúdo que está disponibilizando no seu canal, sou novo no mundo GOLANG, e seus vídeos são excelentes, ensinando muita coisa que é realmente usado no mercado..atualmente trabalho com nodejs, e tudo q vc ensina aqui eu utilizo com node no dia a dia... parabéns pela didática, suas explicações são ótimas e concisas, espero que continue com o trabalho, sucesso e tudo de bom pra você..

josevitormorais
Автор

Excellent delivery! thank you so much for the tutorial:)

MegaSovietRussian
Автор

I found this gem of a channel today and I can't stop binging

rahulsriram
Автор

Thank you so much!!! Your videos are helping me a lot!!

phenvrc
Автор

Thanks for the explanation. What is vendor and go mod vendor and vendor folder.

rsrini
Автор

What if my dependencies are private repo? How can we configure go mod such that it knows our ssh private key in order to access the private repos?

jackedelic
Автор

This is a very detailed explaination for go modules! thank you very much! although I have a question, If youre using branches as versions of the module how would you manage it if you are merging it with the main branch?

thorfinnthegoatmc
Автор

Excellent explanation Mario Carrion!! Can you tell what v0.0.0 means?

abdulrafaykhan