Skip to content

Instantly share code, notes, and snippets.

@gecko655
Last active October 4, 2021 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gecko655/123fb59b979be50fe96e6aa3b80c66d4 to your computer and use it in GitHub Desktop.
Save gecko655/123fb59b979be50fe96e6aa3b80c66d4 to your computer and use it in GitHub Desktop.
package main
import (
_ "embed"
"fmt"
"strings"
)
//go:embed test.txt
var Content []byte
var Table []string
func init() {
Table = strings.Split(string(Content), "\n")
}
func main() {
fmt.Printf("%#v\n", Table)
}
hello
world
@gecko655
Copy link
Author

gecko655 commented Oct 4, 2021

$ go run main.go
[]string{"hello", "world", ""}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment