Go — Day01

Yen
1 min readJun 16, 2022

--

At First

  • install go
  • install VS Code
  • install extension — go

Official Site | Here

Downloading tutorial | My Youtube Channel Here

Start

Why should we learn golang?

  • first-class concurrency primtives
  • type safety enforced by compiler
  • Memory-safe; no use-after-free-bugs
  • very fast(to compiles to machine code)

Always use Packages

  • can import things by dot

Modules

  • collection of packages
  • can be managed by Go Cli

Data Types

statically typed language which is checked at the compiled time

types should be provided by the programmer

all primitives data types are numeric

  • Signed / Unsigned Integer Types
  • float 32/64
  • complex 64 / 128
  • bool
  • type aliases
    - give the new names to existing types
    - converting between types required parentheses

Text Encoding

  • text data uses UTF-8
  • rune type(like char )
  • rune is an alias for int32
  • rune can represent any symbols(e.g. letters, numbers, emoji…)

Creation

rune

//single quote
'a', 'R', '\n'

//backtick
`a`, `R`, `\n`

Strings

"Deposit is $200\n"
"B"

Raw Literals

`Ain't you like "Go!"\n`

Go CLI

  • build
  • run
  • mode
  • test
  • fmt

--

--

Yen

Programming is a mindset. Cybersecurity is the process. Focus on Python & Rust currently. More about me | https://msha.ke/monles