Documentation
Golang 101
0 - Ultimate Gopherlabs
1 - Lets Start With First Hello world Program
2 - Numeral Systems - Decimal
3 - Numeral Systems - Binary
4 - Numeral systems - hexadecimal
5 - Numeral Systems - Loop
6 - Numeral Systems UTF-8
7 - Short variable declarations
8 - Variable with zero value
9 - Deep Drive on Variables
10 - Deep Drive On Constants
11 - Loop Init, Condition, Post
12 - Loop - Nested Loops
13 - Loop - For Statement
14 - Loop - Break & Continue
15 - Generate Random number with math/crypto/rand in Go
16 - Loop - Printing ASCII
17 - Conditional - If Statement
18 - Conditional - If, Else if, Else
19 - Loop, Conditional, Modulus
20 - Conditional - Switch Statement
21 - Conditional - Switch Statement Documentation
22 - Conditional Logic Operators
23 - String Type
24 - Bool Type
25 - Structs
26 - Struct Literal
27 - Pointer to struct
28 - Conversion, Not Casting
29 - Creating Your Own Type
30 - Defer
31 - Stacking defers
32 - Pointer
33 - Prefix Suffix
34 - Conversion between array and slice
35 - methods
36 - variadic function
37 - init Function
38 - Command Line Arguments and File I/O
39 - what is interface ?
40 - Retrieving the Golang version
41 - accessing program arguments
42 - Creating a program interface with the flag package
43 - Retrieving the current working directory
44 - Getting the current process PID
45 - Handling operating system signals
46 - calling an external proces
47 - Retrieving child process information
48 - Reading writing from the child process
49 - Shutting down the application gracefully
50 - file configuration with functional options
51 - Finding the substring in a string
52 - breaking the string into words
53 - Joining the string slice with a separator
54 - Concatenating a string with writer
55 - Aligning text with tabwriter
56 - Replacing part of the string
57 - finding the substring in text by the regex pattern
58 - controlling case
59 - parsing comma-separated data
60 - managing whitespace in a string
61 - indenting a text document
62 - converting strings to numbers
63 - comparing floating-point numbers
64 - rounding floating-point numbers
65 - floating-point arithmetics
66 - formatting numbers
67 - Converting between binary, octal, decimal, and hexadecimal
68 - formatting with the correct plurals
69 - generating random numbers
70 - operating complex numbers
71 - converting between degrees and radians
72 - taking logarithms
73 - generating checksums
74 - reading standard input
75 - Writing standard output and error
76 - opening a file by name
77 - reading the file into a string
78 - Reading writing a different charset
79 - Seeking a position within a file
80 - reading and writing binary data
81 - writing to multiple writers at once
82 - piping between writer and reader
83 - serializing objects to binary format
84 - reading and writing ZIP files
85 - Parsing a large XML file effectively
86 - extracting data from an incomplete JSON array
87 - getting file information
88 - creating temporary files
89 - writing the file
90 - writing the file from multiple goroutines
91 - listing a directory
92 - Changing file permissions
93 - Creating files and directories
94 - Filtering file listings
95 - comparing two files
96 - Resolving the user home directory
Defer
A defer statement defers the execution of a function until the surrounding function returns.
The deferred call’s arguments are evaluated immediately, but the function call is not executed until the surrounding function returns.
package main
import "fmt"
func main() {
defer fmt.Println("world")
fmt.Println("hello")
}
output:
hello
world
in this above program if you use defer keyword it will not execute until the surrounding function returns