go language | golang vs python | go lang for beginners | full stack #golangtutorial #python #coding



go language | golang vs python | go lang for beginners | full stack #golangtutorial #python #coding

go language | golang vs python | go lang for beginners | full stack #golangtutorial #python #coding

Go, also known as Golang, is a statically typed, compiled programming language developed by Google. When you run a Go program, the following steps are involved in its execution:

Compilation:

Go is a compiled language, which means your source code is first compiled into machine code before it can be executed.
You use the go build or go run command to compile and execute your Go program.
The go build command creates an executable file, while go run compiles and immediately runs the program.
Compilation into Machine Code:

During compilation, the Go compiler (commonly known as “gc”) takes your Go source code and translates it into machine code that can be executed by the target platform (e.g., Windows, Linux, macOS).
Linking:

The Go compiler also performs linking, which involves combining the machine code of your program with the necessary libraries and dependencies.
Execution:

Once the compilation and linking processes are complete, you can execute your Go program by running the generated executable or using go run for a one-time execution.
Startup Function:

When your Go program runs, it starts executing from the main function, which is the entry point of any Go program.
The main function should be defined in a package named main.
Here’s a simple example of a Go program: