Embed data files in the binary (#180)
Now that we're on Go 1.16+ we can do this easily! The main advantage is it means users can build a genqlient binary and use that portably (or we could distribute one, or whatever). Plus the code is marginally simpler; the `embed` API is really quite nice. Fixes #9. Test plan: ``` make check go build . rm -rf generate # pretend we have no checkout ./genqlient ./internal/integration/genqlient.yaml ./genqlient --init # fails after generating a default config ```
This commit is contained in:
@@ -124,7 +124,7 @@ func TestGenerate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func defaultConfig(t *testing.T) *Config {
|
||||
func getDefaultConfig(t *testing.T) *Config {
|
||||
// Parse the config that `genqlient --init` generates, to make sure that
|
||||
// works.
|
||||
var config Config
|
||||
@@ -151,7 +151,7 @@ func TestGenerateWithConfig(t *testing.T) {
|
||||
baseDir string // relative to dataDir
|
||||
config *Config // omits Schema and Operations, set below.
|
||||
}{
|
||||
{"DefaultConfig", "", defaultConfig(t)},
|
||||
{"DefaultConfig", "", getDefaultConfig(t)},
|
||||
{"Subpackage", "", &Config{
|
||||
Generated: "mypkg/myfile.go",
|
||||
}},
|
||||
|
||||
Reference in New Issue
Block a user