-
-
Notifications
You must be signed in to change notification settings - Fork 575
models starting with a b produce errors #261
Comments
Hello, this is an issue in https://github.com/markbates/pop, but I can reproduce it. |
Isn't this a scope problem? b Boxes is inside the scope of the function and you are defining again b (b, _ := ...) |
@fooflare The template for model generation defines the variable as "b", and the param as "the first letter of the model". I think this is a real issue. |
I see, now I checked the lines in the issue you opened in pop. The problem is that the name you choose for the variable never can be used as a model name. I love the comments in the 3 functions that are causing the issues :-) |
Oooops!!! I forgot to say that just changing the name of the variable to anything with more than one character would be enough. |
Sounds like an easy PR for someone. :) |
Right now I'm not in front of the computer, but later if nobody does it, I will :-) |
Since it's only a matter of minutes, I'm doing it now. :) |
Closed via https://github.com/markbates/pop/pull/39 |
Hi,
the code for database model generation produce invalid code when the model starts with a b.
func (b Boxes) String() string { b, _ := json.Marshal(b) return string(b) }
This results in compiler errors.
The text was updated successfully, but these errors were encountered: