Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build error by auto-generated file imported and not used: "strconv" #13

Open
shota-takahashi-tg opened this issue Apr 4, 2017 · 2 comments
Assignees

Comments

@shota-takahashi-tg
Copy link
Contributor

Hello,
Thank you a lot for this package. It will be a great help to our Japanese full-text search function.

By the way, I encountered a problem as the title of this issue when I start to use this (latest version 812be11 ).
I only tried to autogen one struct as below:

// +smg
type ChatLog struct {
	ApplicantID string    `search:",string"`
	Body        string    `search:",ngram"`
	Created     time.Time `search:",unixtime"`
}

I checked into codes and this line seem to cause this.
https://github.com/favclip/smg/blob/master/generator.go#L82

thanks again

@shota-takahashi-tg
Copy link
Contributor Author

shota-takahashi-tg commented Apr 4, 2017

I succeeded to avoid this for now by editing struct as below:

// +smg
type ChatLog struct {
	ID          int       `search:",id"`
	DSKeyJSON   string    `search:"-"`
	ApplicantID string    `search:",string"`
	Body        string    `search:",ngram"`
	Created     time.Time `search:",rank"`
}

@shota-takahashi-tg
Copy link
Contributor Author

shota-takahashi-tg commented Apr 4, 2017

Now I've found that the struct definition below causes this:

ApplicantID string    `search:",string"`

string Tag is applicable only to int field

I think it would be better that autogen fails when such definition is set.

Thanks.

@vvakame vvakame self-assigned this Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants