Golang Packages & Scope Explained! - Today's Golang tutorial is all about Golang Packages and Scope. There are 3 levels of scope in Go - block, package, and universe. We will go through each of them and explain how they are applied in Go in today's Golang tutorial video. Enjoy! Golang Dojo is all about becoming Golang Ninjas together. You can expect all kinds of Golang tutorials, news, tips & tricks, and my daily struggles as a Golang developer. Make sure to subscribe if you look forward to such content! Get Your Golang Cheat Sheet! - 🤍golangdojo.com/cheatsheet Git repos & notes - 🤍golangdojo.com/resources Learn Golang in X Minutes Playlist - 🤍youtube.com/playlist?list=PLve39GJ2D71xX0Ham0WoPaYfl8oTzZfN6 Timestamps - 0:00 Intro 0:57 Scope 1:57 Block 4:09 Package 7:45 Universe 10:02 Small Recap 11:53 Import Path 13:24 Outro #golang #goprogramming #golangdojo
hi thank you for your efforts. why didnt you use VScode? because you used that in the first place, i do have some problems in VScode now ,for example: when i declare a variable in a file i cant use it in another file even though both of the files exist in a same directory .
Is each scope its own like (frame?) in memory
Just want to say I love your videos. I appreciate the way you cover the Golang
thank you how do i call a function from the same package / different file and from different package?
Amazing guide, I wish everyone could explain like this! 🙏🙏
I have also have some doubts about relative paths Iif the imported package is going to live in another directory not internet. Do other packages need go mod init?
What would you do I here go mod init demo?
thanks sir. You explained this so well.
Fantastic content.Really like the pace at which you explain the concepts. It’s like reading the book
None of this happens when I try. I cant export no package at all even trying every root trying or go mod init or go get...
Please use dark themes. My eyes are drowning in my own tears.
unfortunately variables from other files are not available for me in main.go. I have package main in both declared on top
I solved it by moving main.go into a separate folder "main" inside root. So in Root I have folders main, packagefolder and go.mod file. The package folder is just any package, with packagefolder.go inside (call the folder and file whatever you like)
If I move main back to root, the app stops working. It took me probably 10 hours to figure this one out (a post in stackoverflow helped me). I tried everything, different editors (Goland VSCode), I tried a different computer, they all didn't work until I moved main.go into its own folder.
Your work is great, your videos are very useful, your channel is a hidden gem hahaha thank you, keep on uploading more videos please
it did same things in package case,,but that every time i get underfined error..........-->both the file are in same floder,,,not any subfloder.......
bro you are doing great work, keep it up!!!
.i have these error \main.go:15:14: undefined: three
I discover your channel when I decided to pick up Go after Java. I think you are doing a fantastic job and definitely deserve more subs !
thanks this helped a lot!
Hey buddy!!! Please make a video about go modules, go mod & go sum......