gogen's People
gogen's Issues
Local and remote sources
As generators can be built into a binary, it is crucial for them to have capability of loading local or remote resources. This should be done by creating "Importers". Importer is interface, that allows generator to retrieve resource that can be e.g. local file (resource.go) or remote gist, etc.
This will allow generators to be more flexible by creating layer, that is able to create resources not bound to the binary file.
Test generator
"As a programmer, I would like to generate test functions for my whole project"
This feature should allow programmers to auto-generate test files with all testing functions.
Segfault on parsing a field of slices of structs from another package
When parsing a structure that looks like this:
type Example struct {
Readers []bytes.Reader
}
gogen panics. Output is this:
dao called
panic: interface conversion: ast.Expr is *ast.SelectorExpr, not *ast.Ident
goroutine 1 [running]:
github.com/flowup/gogen.(*StructField).Type(0xc4201db470, 0xc4201db3e0, 0xc420153a88, 0x8e6b8d)
/home/wscherfel/Go/src/github.com/flowup/gogen/struct_field.go:51 +0x620
github.com/flowup/gobelt/daogen.GenerateGorm.func1(0xc4201e80d8, 0x7ffc91047142, 0x9, 0x8e6b65, 0x1, 0x0, 0x0)
/home/wscherfel/Go/src/github.com/flowup/gobelt/daogen/gorm.go:151 +0xf5d
github.com/flowup/gobelt.Generate(0xc4201e0260, 0x1, 0x1, 0x905db0, 0x0, 0x0)
/home/wscherfel/Go/src/github.com/flowup/gobelt/generator.go:29 +0xdb
github.com/flowup/gobelt/daogen.GenerateGorm(0xc4201e0260, 0x1, 0x1, 0xb, 0x0)
/home/wscherfel/Go/src/github.com/flowup/gobelt/daogen/gorm.go:245 +0x4b
github.com/flowup/gobelt/cmd/gobelt/cmd.glob..func1(0xb1c9c0, 0xc4201e0260, 0x1, 0x1)
/home/wscherfel/Go/src/github.com/flowup/gobelt/cmd/gobelt/cmd/dao.go:36 +0xb8
github.com/spf13/cobra.(*Command).execute(0xb1c9c0, 0xc4201e01e0, 0x1, 0x1, 0xb1c9c0, 0xc4201e01e0)
/home/wscherfel/Go/src/github.com/spf13/cobra/command.go:648 +0x231
github.com/spf13/cobra.(*Command).ExecuteC(0xb1ce00, 0xc420064058, 0x0, 0x8e94e5)
/home/wscherfel/Go/src/github.com/spf13/cobra/command.go:734 +0x339
github.com/spf13/cobra.(*Command).Execute(0xb1ce00, 0xb1ce00, 0xc420153f50)
/home/wscherfel/Go/src/github.com/spf13/cobra/command.go:693 +0x2b
github.com/flowup/gobelt/cmd/gobelt/cmd.Execute()
/home/wscherfel/Go/src/github.com/flowup/gobelt/cmd/gobelt/cmd/root.go:45 +0x31
main.main()
/home/wscherfel/Go/src/github.com/flowup/gobelt/cmd/gobelt/main.go:20 +0x20
Go Source importer
Source importer is a module, that allows to import structures, their function prototypes, constants, etc. from the single golang file. This will enable dynamic use of golang files, which provide context to the generator.
Segfault on parsing a method with reciever not yet defined
Gogen fails to parse files that have only methods in them. It is possible to store the definitions of types in some other file. Example:
package examples
func (r *MyModel) Add() {
//some code
}
This will panic even if MyModel is defined in other file in the same package. Nil assertion should be added.
The specific line that panics is parse.go:124 .
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.