Hello World

2 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
This is a free item
$0.00
د.إ0.00
Kz0.00
ARS$0.00
A$0.00
৳0.00
Лв0.00
Bs0.00
B$0.00
P0.00
CA$0.00
CHF 0.00
CLP$0.00
CN¥0.00
COP$0.00
₡0.00
Kč0.00
DKK kr0.00
RD$0.00
DA0.00
E£0.00
ብር0.00
€0.00
FJ$0.00
£0.00
Q0.00
GY$0.00
HK$0.00
L0.00
Ft0.00
₪0.00
₹0.00
ISK kr0.00
¥0.00
KSh0.00
₩0.00
DH0.00
L0.00
ден0.00
MOP$0.00
MX$0.00
RM0.00
N$0.00
₦0.00
C$0.00
NOK kr0.00
रु0.00
NZ$0.00
S/0.00
K0.00
₱0.00
₨0.00
zł0.00
₲0.00
L0.00
QR0.00
SAR0.00
SEK kr0.00
S$0.00
฿0.00
₺0.00
$U0.00
R0.00
ZK0.00
Already have an account? Log In

Transcript

Hi everyone, in this video, we are going to get started with the first go project. So what I'm going to do is for each section, I'm going to have a different gate branch, so that you can follow each sections code just by clicking on the branch on the gift repository. So you might have noticed that I am in my go path, I am in my folder, and in another folder called section one. So I'm gonna get started by creating a file called main.co. So everything in go is based off on packages. The logic is if I create four files, main one.go into.go, three four.go.

And I write package mean and all of them. What the compiler is going to do is it's going to append all of those files in one main file, which is going to call me which is going to contain all of the code or code of the four packages. The logic here is enforcing modularity, not enforcing, but really helping with modularity by at the same time, not losing the cohesion inside a package. So now I'm going to move on to import the format package, the format packages use for printing lines and logging out stuff. And then every main package is going to have a main function, which is going to be the entry point to the whole code. And then I'm simply going to do FMT dot print line.

Hello World. I'm going to save. To run this project, I'm going to have to be inside the section. And I'm going to have to run go run main.go. Hello. So we finally created our first go project.

To build this project, we can simply do go build main.go and build the project and it inserted the binary in our same folder so that we can do dot slash me, and it's still gonna. So we created our first Hello World project, we understood what packages are, and we successfully compiled code. So see you in other videos. Thank you.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.