August 2019
Beginner to intermediate
798 pages
17h 2m
English
Unsafe code is Go code that bypasses the type safety and the memory security of Go. Most of the time, unsafe code is related to pointers. However, have in mind that using unsafe code can be dangerous for your programs, so if you are not completely sure that you need to use unsafe code in one of your programs, do not use it!
The use of unsafe code will be illustrated in the unsafe.go program, which will be presented in three parts.
The first part of unsafe.go is next:
package main import ( "fmt" "unsafe" )
As you will notice, in order to use unsafe code, you will need to import the unsafe standard Go package.
The second part of the program comes with the following Go code:
func main() { var value int64 = 5 var p1 = &value var ...Read now
Unlock full access