Тёмный

justforfunc #42: Intro to Go Modules and SemVer 

justforfunc: Programming in Go
Подписаться 39 тыс.
Просмотров 45 тыс.
50% 1

Go 1.11 is out and with it Go Modules are ready to be evaluated!
In this episode we chat about what modules are, how we versioned, and manage their dependencies. But not all is chat, keep watching for a demo of how the new `go mod` subcommand works.

Наука

Опубликовано:

 

14 ноя 2018

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 97   
@loveleshsharma9938
@loveleshsharma9938 5 лет назад
I have read many articles on go modules but couldn't got clarity. After watching this video, its totally clear and i have understood the concept. Great video as usual.
@FrancescoDonzello
@FrancescoDonzello 5 лет назад
Awesome, Francesc. I had no time to look at the proposal and in just 30 min you explained how Go Modules work. Thank you!
@taylormonacelli
@taylormonacelli 5 лет назад
Very helpful seeing the errors along the way and how to fix each step. Super stuff!
@julienlevesy3790
@julienlevesy3790 5 лет назад
Dramatic look gopher, made my day !
@naysolange
@naysolange 5 лет назад
simple y práctico! I've read articles about go modules but with this explanation I've understood it definitely. Thanks for the video
@hcblue
@hcblue 5 лет назад
This was so useful! Thanks, Francesc!
@riskyferyansyahpribadi6984
@riskyferyansyahpribadi6984 5 лет назад
this channel very good when explaining about go modules.
@mikjson
@mikjson 5 лет назад
Great video and introduction! Added a link to this video on the Go Modules wiki page in the Introductory Material sub-section. :-)
@tomah911
@tomah911 5 лет назад
Thanks for the video, really clear explanations !
@ankitagarwal655
@ankitagarwal655 5 лет назад
Love Your Every Video :-)
@pulkitkathuria9448
@pulkitkathuria9448 5 лет назад
Thank you. This is by far the best tutorials on go on youtube. Would you be able to address on how to handle when a git repository is removed, force pushed or renamed. More interested in knowing the good practices that we can follow. Like pushing the vendor folder, keeping a local copy of module somewhere?
@RomsyYoutube
@RomsyYoutube 5 лет назад
Thanks for great videos, keep it up :D
@nengsite
@nengsite 5 лет назад
the best golang channel.
@makkalotify
@makkalotify 5 лет назад
This was very useful, thanks !
@xyzale
@xyzale 5 лет назад
Very good explanation, thank you!
@David94305
@David94305 3 года назад
you are a beast man, great work
@joe199194
@joe199194 5 лет назад
Thank you so much. It is so helpful.
@paracha3
@paracha3 5 лет назад
Very informative. Please keep it up
@ultiumlabs4899
@ultiumlabs4899 3 года назад
this video still relevant in 2021. thanks.
@markuswerner1166
@markuswerner1166 5 лет назад
Thanks for this Video. I started with go in August 2018 (go 1.10) and read / watched as much as possible about the history of go. I've read the blog post about "go modules", some more Webpages and watched diffrent Videos about it - Same for SemVer. You bring everything to the point. I'ved development my Adminscripts and some small apps not in GOPATH. Since they were small enough I didn't had trouble with GOPATH at all. I'm in a portable enviroment so I have to use on a network share and set GOROOT = GOPATH (Didn't know it better at that time). I should have splitted it in the first place anyway, cause Versionupgrades are more complicated. But go modules to the rescue, I won't be bothered with it anymore. Currently I think I will stay with the method to have every project in independent directories. I asked my self if it is still a good Idea to split GOROOT and GOPATH cause of the modulecache GOPATH/pkg. What do you think ?
@joonasfi
@joonasfi 5 лет назад
Thanks for this introduction to Go Modules! You earned a subscriber. I am currently using Dep and am waiting for the stable Go Modules version of before I migrate all my projects. Can I suggest that if it's not too troublesome, publish the major subject timestamps in the description? I wanted to skip directly to the Go Modules part because I'm already familiar with SemVer. BTW it's awesome the way you pronounce "module" :)
@MrLucevers
@MrLucevers 5 лет назад
Thanks!
@mishasawangwan6652
@mishasawangwan6652 5 лет назад
thanks great video
@ovidiub13
@ovidiub13 5 лет назад
29:27 you can just do: «grep -R *» and it will have the same result, but it's quicker to type.
@GerardoOscarJT
@GerardoOscarJT 5 лет назад
Hi Campoy! Thanks for your video. With modules, is still possible having the vendor directory to commit all dependencies?
@quillaja
@quillaja 5 лет назад
So this is the "official" version of vgo? Thank you for another quality video!
@yf4453
@yf4453 4 года назад
Finally we have hermetic builds!
@arhyth
@arhyth 5 лет назад
this was really helpful! i tried reading golang modules doc but found it too dense for a noob given a "legacy" codebase just trying to add and test a small piece of code.
@gregfrllo
@gregfrllo 4 года назад
i think i'm falling in love
@kalyan120
@kalyan120 5 лет назад
This is cool. Great video on a much needed feature. Would it be a best practice to check in the go.sum file as well?
@JustForFunc
@JustForFunc 5 лет назад
Yeah, I mention it at some point. It should be added to your git repos.
@skwtf
@skwtf 4 года назад
Thanks for the video. I didn't understand if modules are a best practice or should be used only if you have dependencies? For example if I have a simple script, that uses only built in Go packages - do I need to use modules?
@antanaskiselis7919
@antanaskiselis7919 5 лет назад
How does it solve dependency conflicts, like depending on different version of the same thing? Or each module is an island on it's own?
@attilao
@attilao 5 лет назад
Interesting to see that while Go package versions should start with "v", Go itself does not seem to start with "v". When you typed go version, it printed "go1.11.2".
@Goodvvine
@Goodvvine 5 лет назад
Is the vendor directory updated when you update your dependencies? or do you have to run `go mod vendor` again?
@mekegi
@mekegi 5 лет назад
not autonatically. every time you need run `go mod vendor` But if your IDE has support of `go modules` you don't need vendor folder github.com/golang/go/wiki/Modules#what-is-the-status-of-module-support-in-ides-editors-and-standard-tools-like-goimports-gorename-etc
@manikanth2166
@manikanth2166 5 лет назад
Both golang and node.js had the same problem in versioned dependency resolution. And it looks like go borrowed heavy inspiration from node as both maintain hash to point to the dependency version. It's package.json and package-lock.json ressemble go.mod and go.sum files here.
@eaglesongs
@eaglesongs 5 лет назад
Awesome and helpful video. Thanks! @23:25 when cloning embedmd, the latest version actually already contains go.mod and go.sum, just FYI.
@JustForFunc
@JustForFunc 5 лет назад
I don't think so, no. Unless you mean when you clone it now.
@eaglesongs
@eaglesongs 5 лет назад
Yes I meant when following along now...
@JustForFunc
@JustForFunc 5 лет назад
@@eaglesongs Hah, yeah. Of course now embedmd is a module like all good Go package should do 😎
@johnmackenzie534
@johnmackenzie534 5 лет назад
How would this work with an api codebase? Do I still use modules for the bigger Go codebases or are they only for packages/libraries?
@cristianocolangelo7745
@cristianocolangelo7745 4 года назад
Do I still need to use Go modules if I'm just creating a standalone application (so no outside imports) living inside gopath? Or should I do that as a best practice?
@TristanColgate
@TristanColgate 5 лет назад
If you do another vide on modules it might be worth mentioning that backward compatability doesn't count for v0.x.y. I hadn't really heard it said much and it came as a suprise when I first heard about it.
@realB12
@realB12 4 года назад
Excellent Tutorial. Phantastic Speaker! Let me know where I can donate some bucks!
@shadowfaxenator
@shadowfaxenator 5 лет назад
How to correctly change module name and repo it is stored ? For example if I want to start with github and then replace with gitlab
@robinlemagnifique2778
@robinlemagnifique2778 5 лет назад
Thanks for the video! Not sure to understand the last part with the S/sirupsen issue, I was expecting some magic there but in the end you have to manually change the import in the vendors, so what's the point?
@JustForFunc
@JustForFunc 5 лет назад
The point is that code used to work, but doesn't anymore once you start using modules. So it's good to know what the message means and how to fix it
@julian7
@julian7 5 лет назад
@@JustForFunc if you look at 26:27, github.com/Sirupsen/logrus v0.0.0-20170706134407-59d0ca71e5fa was included in the original repo. At some point of time (see github.com/sirupsen/logrus/pull/384) the package has been renamed from github.com/Sirupsen/logrus to github.com/sirupsen/logrus. This causes extra issues on case-insensitive systems like MacOS and Windows.
@hackdan
@hackdan 5 лет назад
Thanks, please review gorm vs other vs native
@manosragiadakos3928
@manosragiadakos3928 5 лет назад
is dep going to be replaced by go.mod in the future ?
@trexiath
@trexiath 5 лет назад
Yes
@JustForFunc
@JustForFunc 5 лет назад
What Tom said!
@ntrrg
@ntrrg 5 лет назад
Thanks! this is a great explanation (and demonstration) about that concepts. 29:30 You may also use grep -r github.com/Sirupsen/logrus **/*.go
@nyrtzi
@nyrtzi 5 лет назад
Just wondering how going outside GOPATH will affect using guru. Does guru find imports that are outside GOPATH?
@androth1502
@androth1502 5 лет назад
so this is like a more obfuscated and complicated implementation of rust's cargo?
@mnfchen
@mnfchen 5 лет назад
Great video! Very quick follow-up questions: 1. Can your go module depend on non-modules (i.e. they don't have go.mod)? In other words, can you depend on something that isn't semantically versioned? 2. How do you set the semantic version of your module? Through git tags? In go.mod?
@greiezer
@greiezer 5 лет назад
1.) depending on code that does not yet define go.mod files will result in v0.0.0-git-latest-commit-hash as the version, e.g. golang.org/x/crypto v0.0.0-20181025213731-e84da0312774 see go.googlesource.com/go/+/refs/heads/master/src/go.mod
@tejinderkaur2120
@tejinderkaur2120 3 года назад
My package exists at [/root/go/src/myProj/drivers/myPkg] in GOPATH (/root/go) I am importing it in /root/go/src/myProj/myComponent/xyz/abc/server.go but I get the following Error: package myProj/drivers/myPkg is not in GOROOT (/usr/local/go/src/myProj/drivers/myPkg) Why is it not checking the GOPATH location?
@Oswee
@Oswee 4 года назад
:( stepping into bit more advanced workflow and found all this go modules thing bit confusing. Like... i am working on some nested module (monorepo) in separate branch... made some protobufs, later updated those and then in the same branch i want to use those updated protobufs, but i can't because my imports are pointing to previous version of protobufs. Its just becomes really messy to keep in head all this stuff.
@sarvsn9125
@sarvsn9125 5 лет назад
Hi thank you for the video it was quite informative . Currently we are using go with oracle. We are using go-oracle which uses C code, I know mod does not copy the non-go code in the vendor directory. Due to this my compilation breaks. Is there a way to handle such a situation?
@JustForFunc
@JustForFunc 5 лет назад
You might want to ask this in golang-nuts or the gophers slack channel
@assaf6142
@assaf6142 5 лет назад
How to use a dependency which doesn't use go modules? Can I specify "latest" in go.mod for one of my dependencies?
@JustForFunc
@JustForFunc 5 лет назад
If you try it you'll see go.mod will use the commit hash instead of the tag Not sure whether latest exist or whether it's a good idea ... at that point you might as well not track dependencies
@assaf6142
@assaf6142 5 лет назад
​@@JustForFunc Thanks :-)
@manikanth2166
@manikanth2166 5 лет назад
Looking for a video on syscall. How those systemic specific packages went out of go main repository. How to rightly use them? And an example of cross platform build (mmapped i/o on linux vs windows).
@cdromhelp
@cdromhelp 5 лет назад
Hey. Is it possible to use versioning in import block? For instance package pack1 import ( "github.com/noname/superpac v1.2.3" ) package pack2 import ( "github.com/noname/superpac v1.4.3" ) package pack3 import ( "github.com/noname/superpac v2.2.3" )
@JustForFunc
@JustForFunc 5 лет назад
Nope
@ehsanranjbar6571
@ehsanranjbar6571 5 лет назад
If i create a module with name foo and upload that to github.com/ehsanranjbar/bar How should i import that and how go mod can find repo?
@alskidan
@alskidan 5 лет назад
I'm confused. semver.org/spec/v2.0.0.html says nothing about "v" prefix. It seems to me that "v0.1.0" is not semver compliant, but "0.1.0" is.
@JustForFunc
@JustForFunc 5 лет назад
That's why I said "in Go", yeah
@starllama2149
@starllama2149 5 лет назад
Lmao this guy loves golang
@EnricoCandino
@EnricoCandino 5 лет назад
How do modules work with cross-dependencies? For example, if I am using foo/goofy and bar/mickey, and they are both using mylib/common but with different version of it? Probably the "not vendored" version could work since they are probably referencing different things under the pkg/mod directory, but how the vendor folder will be?
@kalekold
@kalekold 5 лет назад
The lowest version that satisfies both is used.
@JustForFunc
@JustForFunc 5 лет назад
answered on twitter! twitter.com/francesc/status/1063180187251044352
@Medardusai
@Medardusai 5 лет назад
In the same major version the lowest satisfying version will be used. For different major versions the packages will be handled as different packages. Cox' blog has a good entry on it, I think this is the correct entry: research.swtch.com/vgo-mvs
@borislenzinger8907
@borislenzinger8907 5 лет назад
Hi Francesc, you say in the video that you would be happy to run your workshop in a conference. I'm part of RivieraDev organizers and I would like that you apply in the CFP for a Go workshop. How can I get in touch with you to talk about this ?
@JustForFunc
@JustForFunc 5 лет назад
Easiest way is campoy@golang.org
@borislenzinger8907
@borislenzinger8907 5 лет назад
@@JustForFunc Sent ! Thank you ! :-)
@Euryugasaki
@Euryugasaki 5 лет назад
I dont really understand why we still need to use "go get something". How about "go mod get" "go mod remove" "go mod update path@specific_version" "go mod downgrade path@specific_version" and so on? It makes everything stick to "go mod" instead of two type of command.
@JustForFunc
@JustForFunc 5 лет назад
Why "go mod get" when "go get" does the trick?
@mearpitjain09
@mearpitjain09 5 лет назад
Wasn't this published earlier ? 🧐
@JustForFunc
@JustForFunc 5 лет назад
earlier than ... ?
@akshaynaik4888
@akshaynaik4888 5 лет назад
nice as all your videos, but can you make explicit video on only go modules more simplified without semver etc
@JustForFunc
@JustForFunc 5 лет назад
@@akshaynaik4888 go modules is all about dependencies and versioning, so ... no
@akshaynaik4888
@akshaynaik4888 5 лет назад
@@JustForFunc okay,😊
@sunilk9760
@sunilk9760 5 лет назад
millitary standard mike
@ovidiub13
@ovidiub13 5 лет назад
You can just use apt instead of apt-get when you run it from the prompt. It's shorter and it's a single command for multiple actions. The apt-get, apt-cache, etc are still to be used when scripting for clarity.
@piyushchugh6148
@piyushchugh6148 5 лет назад
7.40 is the part you should jump to if you want to directly learn to code around Go Modules and skip the Modules and SemVer theory part.
@licoresse
@licoresse 5 лет назад
Semantic versioning has been fundamentally broken since its inception.
@JustForFunc
@JustForFunc 5 лет назад
Why? You can't simply drop statements like that without a justification
@VictorZamanian
@VictorZamanian 5 лет назад
Repossery? Are you trying to say "repository"?
@JustForFunc
@JustForFunc 5 лет назад
Are you trying to say "thanks for the video"?
@theocrevon6374
@theocrevon6374 5 лет назад
Are you trying to be a dick?
@jazzochannel
@jazzochannel 4 года назад
What is a reposiry? Is it similar to a "repo"? I think you forgot and transposed a couple of letters there.. reposiry repository hm.. levenshtein difference of 2... compiler-brain says: DOES NOT COMPUTE reposi__ry repository you need to enunciate those two sounds.... tee, ooo do you see how what you are saying is different from the dictionary defenition? re-po-si-to-ry re-po-si-ry So no, I was wrong, you didn't transpose anything, you just skipped two letters. Maybe not a big deal, but it is surely funny :) I am going to test this out on my co-workers. REPOSIRY! or even RESORY or even RESY. I am sure they are smart dudes and will understand what a RESY is ;)
@JustForFunc
@JustForFunc 4 года назад
*definition
Далее
Joy and Anxiety Mood (Inside Out Animation)
00:13
Просмотров 400 тыс.
Go Tooling  in Action
41:51
Просмотров 115 тыс.
justforfunc #32: CLI tools with Cobra
27:08
Просмотров 35 тыс.
justforfunc #16: unit testing HTTP servers
48:31
Просмотров 71 тыс.
How to Do 90% of What Plugins Do (With Just Vim)
1:14:03
Просмотров 873 тыс.
justforfunc #22: using the Go execution tracer
35:55
Просмотров 21 тыс.
justforfunc #33: the Rise And Fall of CORBA
21:52
Просмотров 14 тыс.
justforfunc #37: sync.Pool from the pool
27:11
Просмотров 17 тыс.
justforfunc #9: The Context Package
36:27
Просмотров 138 тыс.
Игровой Комп с Авито за 4500р
1:00
😮Новый ДИРЕКТОР Apple🍏
0:29
Просмотров 37 тыс.
Треш ПК за 420 000 рублей
0:59
Просмотров 246 тыс.