vektah / dataloaden

go generate based DataLoader
MIT License
530 stars 79 forks source link

File not generated: unable to gofmt #30

Closed acelot closed 5 years ago

acelot commented 5 years ago

I have simple structs:

package models

type Article struct {
    ID      int       `json:"id"`
    Title   string    `json:"title"`
    Authors []*Author `json:"authors"`
}

type Author struct {
    ID       int    `json:"id"`
    FullName string `json:"fullName"`
}

I get an error when trying to generate dataloaders:

go run github.com/vektah/dataloaden AuthorLoader int *git.rn/gm/service-articles/internal/models.Author

unable to gofmt: /home/pioneer/sources/gm/service-articles-go/internal/dataloaders/authorloader_gen.go:6:1: expected 'IDENT', found 'import'
exit status 2

What I'm doing wrong?

acelot commented 5 years ago

OK, i'm realized that dataloaden must be executed from same directory as target model.