Check out example codes for "go if file exists". It will help you in understanding the concepts better.

Code Example 1

import "os"

func main() {
	if functs.FileExists("path/to/file") {
		fmt.Println("Example file found.")
	} else {
		fmt.Println("Example file not found!")
	}
}

func FileExists(filename string) bool {
	info, err := os.Stat(filename)
	if os.IsNotExist(err) {
		return false
	}
	return !info.IsDir()
}

Learn ReactJs, React Native from akashmittal.com