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

make generate works but then causes make server to fail with : "main.go:18:2: import "github.com/GoAdminGroup/example/tables" is a program, not an importable package" #6

Open
joe-getcouragenow opened this issue Sep 8, 2020 · 2 comments

Comments

@joe-getcouragenow
Copy link

joe-getcouragenow commented Sep 8, 2020

The tables folder is a main package.


make generate 
go install github.com/GoAdminGroup/go-admin/adm
go: finding module for package github.com/AlecAivazis/survey/v2
go: downloading github.com/lib/pq v1.3.0
go: finding module for package github.com/jawher/mow.cli
go: finding module for package github.com/tdewolff/minify
go: downloading github.com/go-sql-driver/mysql v1.5.0
go: finding module for package github.com/tdewolff/minify/js
go: finding module for package github.com/tdewolff/minify/css
go: finding module for package github.com/jteeuwen/go-bindata
go: finding module for package github.com/schollz/progressbar
go: finding module for package github.com/AlecAivazis/survey/v2/core
go: downloading github.com/tdewolff/minify v1.1.0
go: downloading github.com/jawher/mow.cli v1.2.0
go: downloading github.com/AlecAivazis/survey/v2 v2.1.1
go: downloading github.com/jteeuwen/go-bindata v3.0.7+incompatible
go: downloading github.com/schollz/progressbar v1.0.0
go: downloading github.com/AlecAivazis/survey v1.8.8
go: downloading github.com/tdewolff/minify v2.3.6+incompatible
go: found github.com/AlecAivazis/survey/v2 in github.com/AlecAivazis/survey/v2 v2.1.1
go: found github.com/AlecAivazis/survey/v2/core in github.com/AlecAivazis/survey/v2 v2.1.1
go: found github.com/jawher/mow.cli in github.com/jawher/mow.cli v1.2.0
GoAdmin CLI v1.2.16

? choose table to generate [select all]
? generate permission records for tables yes

✔ generating: 

 100% |████████████████████████████████████████| [0s:0s]            

Generate data table models success~~🍺🍺

see the docs: https://book.go-admin.com
visit forum: http://discuss.go-admin.com


make serve  
go run .
main.go:18:2: import "github.com/GoAdminGroup/example/tables" is a program, not an importable package
make[1]: *** [serve] Error 1
make: *** [run] Error 2

@joe-getcouragenow
Copy link
Author

So the fix is:

rename packages in tables to be "tables": https://github.com/GoAdminGroup/example/tree/master/tables

package tables

and in tables.go: https://github.com/GoAdminGroup/example/blob/master/tables/tables.go#L20

rename this

"users":   GetUsersTable,

These changes have to happen in the generator though at: https://github.com/GoAdminGroup/go-admin/blob/master/adm/generate.go

"packageName" is the variable: https://github.com/GoAdminGroup/go-admin/blob/master/adm/generate.go#L69

@brookyu
Copy link

brookyu commented Sep 20, 2020

i'm having the same problem here, what can we do locally?

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