go-genslice
is a cli tool to generate go slice code.
go get -u github.com/paulvollmer/go-genslice
Sample input file
hello
world
Command to generate a string array:
go-genslice -d sample.txt -t string
The generated code result:
// Code generated by "go-genslice"; DO NOT EDIT.
package main
var Data = []string{
`hello`, // 0
`world`, // 1
}
MIT - See LICENSE file