imperfect-fourth / eywa

A flexible ORM-style GraphQL client
7 stars 0 forks source link

eywagen: avoid generating fields file if all models are skipped #10

Open scriptnull opened 3 months ago

scriptnull commented 3 months ago

I had one model for which I didn't implement the eywa.Model interface. So running go generate ./... resulted in

struct type Deployment does not implement eywa.Model interface, skipping...

But at the same time, a file that leads to a compile error is added to the package.

// generated by eywa. DO NOT EDIT. Any changes will be overwritten.
package model

import (
    "github.com/imperfect-fourth/eywa"
)

Error is

$ go run main.go 
model/eywa_fields.go:5:2: "github.com/imperfect-fourth/eywa" imported and not used

So let us avoid writing this file if there is no model implementing the interface.