Giter Site home page Giter Site logo

goastch's People

Contributors

helloyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

goastch's Issues

Contributing - documentation & interface for go/analysis

I love this idea for improving the AST node matching capabilities of golang, and I'd like to contribute. The go/ast package is bare bones with only slight improvements in go/astutil. This is really a shame, since golang is so often used with build tools and has utilities like go generate for build tooling.

This repo contains powerful node matching capabilities like what's possible in popular parsers (ESLint, Babel). Unfortunately it's not very discoverable - see this post from the SeatGeek software dev blog lamenting the lack of a Golang AST node matcher - or well-documented, so I'd like to help out on both those fronts if I can. To that end, my ideas are:

  • start by updating the README to offer an overview of the capabilities of goastch and sort the APIs into these capabilities.
  • continue by adding common recipes to the README
    • structural matching, ex: the if err != nil matcher in the blog post above
    • logical matching, ex: Any('if err != nil', 'if nil != err') for files not suppressing errors, else no match
    • traversal matching, ex: a go func() {}() literal contains a reference to a loop variable in its closure (this is being fixed in Go 1.22, may need to think of a better example)
    • goal is to use every user-facing function in 1 or more recipes to provide functional documentation of the APIs
  • since the most common uses of an AST are linting/fixing and codemods, write a thin wrapper for interfacing with go/analysis or provide an example of how to do so

I also have ideas for features and extending functionality, but I'd love to see this project gain wider visibility. This seems like the lowest-hanging fruit to improve usability & visibility. Please let me know if you're interested and how I can help if so.

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.