mdawar.dev

A blog about programming, Web development, Open Source, Linux and DevOps.

Go - Composite Types

Array

A fixed-length sequence of values of the same type (e.g. [10]int, [5]string).

Slice

A dynamic-length sequence of values of the same type (e.g. []int, []string).

Map

A data structure that maps keys to values (e.g. map[string]int).

Struct

A composite type that groups together multiple values with different types.

Pointer

A type that holds the memory address of a value (e.g. *int, *bool).

Channel

A type that enables communication between Goroutines (e.g chan int, chan bool).

Function

A function type denotes the set of all functions with the same parameter and result types.

Interface

An interface type defines a type set.