The following code shows the difference between the signed and unsigned integers, this helps us better understand what happens under the hood when we write a program

package main
 
import "fmt"
 
func main() {
	var integer int8
	var unsignedInterger uint8
 
	integer = int8((1 << 7) - 1)
	unsignedInterger = uint8((1 << 8) - 1)
 
	fmt.Println(integer, unsignedInterger)
}

You can see that integer is a variable of type int8, which means that it has 8 bits and can contain both negative and positive values

whereas the unsignedInteger is of type uint8 which means that is has 8 bits and can store only the positive values

Fun fact

though they both have 8 bits of memory the maximum value that can be stored by each of them is different, this is because that int8 reserves the MSB ( most significant bit ) to know whether the number is positive or not.

due to this the maximum number that can be stored in the int8 type is 127 whereas the uint8 does not have any limitations like that and the maximum number that can be stored is 255