package main import "fmt" var temp int64 = 10 func main() { fmt.Println(temp) test() fmt.Println(temp) s := "test2" suffix := ".png" res := test2(s, suffix) fmt.Println(res) } func test2(s, suffix string) bool { t1 := len(s) >= len(suffix) t2 := s[len(s)-len(suffix):] == suffix temp := t1 && t2 return temp } func test() { fmt.Println(temp) temp = 100 }