Giter VIP home page Giter VIP logo

Comments (3)

jeevatkm avatar jeevatkm commented on May 25, 2024

@adrianlop Found the root issue why it was unable discover the method from controller struct.

I have reviewed you code and also aah AST flow. When Package files gets processed by aah AST code. There are no guaranteed order in the file processing for type & method since its type map[string]*File.

aah/ainsp/program.go

Lines 90 to 104 in 8c41d00

for name, file := range pkgInfo.Pkg.Files {
pkgInfo.Files = append(pkgInfo.Files, filepath.Base(name))
fileImports := make(map[string]string)
for _, decl := range file.Decls {
// Processing imports
pkgInfo.processImports(decl, fileImports)
// Processing types
pkgInfo.processTypes(decl, fileImports)
// Processing methods
processMethods(pkgInfo, prg.RegisteredActions, decl, fileImports)
}
}

So as per your code, controller defined oncaller.go and action methods are defined all three files. Following log lines from random execution on my machine would convey what I mean.

2019-02-06 22:08:01.329 ERROR AST: Method 'TriggerGrafanaCall' has incorrect struct recevier 'Controller' on file [/xxx/ops-api/app/controllers/oncaller/grafana_webhook.go] at line #12
2019-02-06 22:08:01.329 ERROR AST: Method 'TriggerPrometheusCall' has incorrect struct recevier 'Controller' on file [/xxx/ops-api/app/controllers/oncaller/prometheus_webhook.go] at line #15
2019-02-06 22:08:11.154 ERROR AST: Method 'TriggerPrometheusCall' has incorrect struct recevier 'Controller' on file [/xxx/ops-api/app/controllers/oncaller/prometheus_webhook.go] at line #15

So solution to address this issue is to process all types for the package first and then go for processing methods.

from aah.

jeevatkm avatar jeevatkm commented on May 25, 2024

I have made a release of aah v0.12.3 && cli v0.13.4.

from aah.

adrianlop avatar adrianlop commented on May 25, 2024

just updated the framework and the cli. it's working :)
great stuff @jeevatkm, thank you very much for fixing this!

from aah.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.