Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/j0rgeserran0/golang-introduction-samples

Basic samples to learn Go
https://github.com/j0rgeserran0/golang-introduction-samples

basic basic-learning go goland programming samples

Last synced: 23 days ago
JSON representation

Basic samples to learn Go

Awesome Lists containing this project

README

        

# **Go** Introduction Samples
Introduction and basic samples to practice and learn with **Go**

[](images/gopher.jpg)

This repo has been created to help you to adopt **Go** and learn about it

[Spanish - (Blog) Introducción a Go o Golang](https://geeks.ms/jorge/2021/01/15/introduccion-a-go-o-golang/)

# Features of **Go**

Some of the most important features of **Go** are:

- manages the memory for us
- has been created thinking in the concurrency paradigm
- compile to standalone binaries (not interpreted)
- is fast in compilation times (giving us a quick feedback about errors or problems)
- is simple to use
- is strongly typed
- is statically typed

# First steps

If you have not installed *Go* on your computer, please... follow this steps

1) [**Download Go**](https://golang.org/doc/install)
2) Install it!
3) Open your terminal or command prompt and write

``` go
go version
```

You should see information about **Go** and the version installed on your computer

## **Go** file extension

All your Go files should have the extension **.go**

For example:

``` Go
main.go
```

## Basic **Go** commands

There are a lot of commands inside of *Go*

The basic commands that you will be use for sure are:

* To execute your code:

``` Go
go run main.go
```

* To build your code in a standalone binary:

``` Go
go build
```

## Write you own **Go** programs!

Use some editor to create or modify the samples

- [Atom](https://atom.io/) is a good tool to do it

- [Visual Studio Code](https://code.visualstudio.com/) ins another very good tool (*is the tool that I use really*)

The most important here is to use the tool that you want and to be comfortable with it

One important thing here

> **If you want to use Visual Code as me, don't forget install the [*Go for Visual Studio Code extension*](https://marketplace.visualstudio.com/items?itemName=golang.go)** *This extension for Visual Studio Code is not necessary but helps*

But if you want to run your *Go* code without install anything... you can!

You can test your *Go* code in the official web site, or in [*Go Playground* directly](https://play.golang.org/)

# Samples

> [**Complete source code here src**](src/)

In *Go Playground*:

- [Hello Go-rld](https://play.golang.org/p/krbWvuOZuT7)
- [Go - Variables](https://play.golang.org/p/WQbcgSWHV56)
- [Go - DataTypes](https://play.golang.org/p/dYvgXL2mLTV)
- [Go - Constants](https://play.golang.org/p/sGqO55JbWNJ)
- [Go - Operators](https://play.golang.org/p/5H97epegqTU)
- [Go - Arrays](https://play.golang.org/p/n-fv6E88qCz)

# Resources

* [Official Golang Web Site](https://golang.org/)
* [Downloading an expecific version](https://golang.org/dl/)
* [Go Language Specification](https://golang.org/ref/spec)
* [Go Packages](https://golang.org/pkg/)
* [Go Playground](https://play.golang.org/)
* [Go Bridge](https://github.com/gobridge/about-us/blob/master/README.md)