Hello world program of Go

Now we are going to move on to the Write code part.

We have completed our environment setup, and now it is time to sart working on our first very small program .

The first program that we are going to woking on is actually a "Hello world" type application.

In this section,we will figure out how to create a "Hello world" program of Go. In the next section,we will talk about each and every line of code in this program and do a really deep dive on Go how to work behind the scenes

If you prefer, you can skip this chapter.

We are going to put the whole program up on the screen

Now Let us satrt off by creating a new project folder.

You can find the File option at the top menu bar. and then click on the Open Folder option in the pop-up menu.

After you do that, a window should pop up, and then you should select a directory that you want to house your first program . And click on the "Select folder" button to open up the new folder.

Now you can locate the HelloWorld project in the pop-up left hand navigation panel.

The Navigation panel is what allows us to view all different files and folders that are inside of our working project.

Let us click on that area that says HelloWorld, You should see a set of buttons on the top right of the Navigation panel like this.

Then let us create a new file by clicking on the New File button,And call the file "main.go".

When we do that , you should have a code editor window open like this.

So Inside here is where we are going to put a hello world type program.

Now I will show how to write out the tiny program in this video. Let us go.

lesson 6

As that video says,we have completed writing out the whole hello world type program. We will discuss each and every line of code of the simple program in great detail. So see you next chapter

The original video and subtitles

Video: Hello World

subtitles :

Now that we are all done with our environment set up.

We are going to start working on our first very tiny, very little program.

Now the first program we are going to work on is essentially going to be a "Hello world" type app.

We are just going to connect console log out or log out some little piece of data.

And so I know this is a very boring program to start off with.

But trust me we are going to do a really deep dive on exactly how Go is working behind the scenes.

We are going to learn a lot about how we compile build projects all this kind of good stuff by just studing this tiny little program.

So even though it is going to be a very small program, we are going to learn a lot out of it.

So We are going to flip on over toward code editor.

In this section we are just going to wirte out a very simple program and then we will take a break,come back in the next video and we will start to do the deep dive on exactlly how it is working.

So I am going to start off by creating a new project folder to house the little program.

I am going to go up to file. I will click on Open and then I am going to make a new folder to house this new project.

It is going to click on the new folder down here and I am going to call the new folder

Now once I craete that new folder I should see it become selected and click on Open down here at the bottom to open up the newly created folder.

Now when I click on open I should see the left hand nav open up on the Explorer tab.

The Explorer tab is what allows me to view all different files and folders that are inside of my working project directory.

If you do not see the Explorer tab over here. You can always go to View and then click on Explorer right here.

Now inside of this hello world directory,

We are going to create a new file by clicking on the new file button right here.

So we are going to make a new file and call it main dot go

So inside here is where we are going to put a hello world type program.

Again we are going to jsut speed through the code right now.

We are going to throw it all up on the screen.

We are going to take a break and then come back and talk in great detail about each and every line that we are wirting out.

So let us just throw the code up here and then we will talk about what is going on in a moment.

So we will start off by saying package main.

Underneath that will say import ftm and make sure that "fmt" is inside of double quotes, not single quotes we want double quotes here.

And then underneath that will say "fun main",we will put a set of parentheses,

We will put a set of curly braces and inside of there "fmt.println" and make sure that print has a capital P and we will pass it another string of "Hi there" like so.

Now one thing I want to point out to you very important to make sure that you have double quotes both on the import statement right here and on the string that we are passing to the println function.

All right, so now we have put together a very simple and very basic program.

We are going to take a quick break and we are going to come back and we are going to figure out how to run the program and we are going to talk about each and every line code inside here in great great detial.

Quick break, we are going to come back and really dive into this code.

previous page: Cursor installation and GO configuration

next page:

相关推荐
喵个咪11 分钟前
Go 写业务,Rust 扛底盘:一套可落地的混合架构
后端·rust·go
小小张说故事35 分钟前
Python logging 日志不输出?根源在 propagate 这条链上
后端·python
mmsx42 分钟前
Android Dialog 插槽模式:用一套壳统一全应用的弹窗风格
android·java·dialog·开发语言
EatFan44 分钟前
Go语言全栈实战:基于 Gin + Vue + JWT + RBAC 从零搭建前后端分离权限管理系统
vue.js·golang·go·vue·gin·jwt·rbac
huanbailu1 小时前
Qt 跨线程信号槽:connect 返回 true 但槽函数不执行的坑
开发语言·c++·qt·信号槽·跨线程·元类型
ZealSinger1 小时前
Go slog生产落地LevelVar与共存
开发语言·后端·golang·go
落魄实习生1 小时前
Agent Scope Java 2.x 系列【11】AgentState 与状态存储
java·开发语言·ai
HEJOO91 小时前
C++ 虚函数表(vtable)深度解析
开发语言·c++
老王爱玩车1 小时前
深入理解指针5
c语言·开发语言·学习
丹宇码农1 小时前
Go 与 Python 协程(Coroutine)对比演示项目
开发语言·python·golang