Golang is a programming language developed by Google. It can used to create cloud services, web , CLI tools etc. The first step to use Go is download and install the SDK.
Hello world
After the installation please check the environment variables, make sure the path being added your system.
go version
go env
Now you are ready to stat writing your code. create a simple directory and cd into it.
on the terminal issue the following command to initialize the project module.
go mod init example/helloword
It will create .mod file which is similar to package.json in Nodejs projects where dependencies listed.
create main.go
This is the entry point to your project. Every go program should start with a main function
//main.go
package main
import "fmt"
func main(){
fmt.printline('Hello word')
}
Run the project
By using go run . or go run main.go can execute the program.
- How to add packages in Golang
- Create REST API using gin in Golang
- How to Containerize Golang app with Docker
- How to create API using mux in Golang
- How to create API using gin in Golang
- How to create API using Fiber in Golang
- Set up golang project
- How to use GORM packages in Golang
- How to solve gcc error in Golang -Windows