2. Hello World
#golang #helloworld
To make sure that everything is running as expected let's write a quick "hello world" program.
Create a new folder where the project will live and run the following command:
Running the command will create the go.mod file.
We then have to create a main.go
file in the same directory.
The hello world code is shown below:
main.go
To simply run the code, navigate to the same directory as main.go
and execute:
To build it as a stand alone executable simply run
The beauty of go unlike other languages is that it will figure out all dependencies and packages used. No need to download them separately.
Last updated