Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ramaraju-personal-org/go_basics

This repo has detailed explanation about golang basics
https://github.com/ramaraju-personal-org/go_basics

arrays concurrency constructors control-structures for-loops functions goroutines interfaces json-conversion maps methods pointers slice struct-tags structure variadic-functions

Last synced: 4 days ago
JSON representation

This repo has detailed explanation about golang basics

Awesome Lists containing this project

README

        

# Go Basics

> \[!NOTE]\
> First go to the folder where the go file is present.

- ##### To run a go application in development :
```bash
go run firstCode.go
```
- ##### In production :

```bash

# initialize the module (on MacOS)
go mod init /path/to/your/goFile/customModuleName
# build the module
go build
# Run the module and get the executable file (on MacOS)
./customModuleName
```
- Go has modules and each module has multiple packages
- Should have atleast one package in a file
- A single package can be split accross multiple go files
- Can have multiple packages in one go file also
- [Go standard libraby for packages](https://pkg.go.dev/std)

![packages](images/pacakgesInGo.png)
![packages](images/example.png)