//go:embed config.json var configData string
//go:embed templates/*.html var templateFS embed.FS package main import ( "embed" "log" ) go file links
Create a hard link err := os.Link("original.txt", "hardlink.txt") Check if two files are hard-linked s1, _ := os.Stat("file1.txt") s2, _ := os.Stat("file2.txt") if os.SameFile(s1, s2) fmt.Println("Same file (hard link)") //go:embed config
This is the most common "file link" in modern Go—it links external files into your executable at compile time. Basic usage package main import _ "embed" _ := os.Stat("file1.txt") s2
//go:generate stringer -type=Pill //go:generate go-bindata -o static.go static/ Run with:
//go:embed static/* var staticFiles embed.FS