Coder Social home page Coder Social logo

Comments (3)

dominikh avatar dominikh commented on May 29, 2024

To be honest I am inclined to remove the check. It does catch some unnecessary allocations, but so do go test and pprof... staticcheck, on the other hand, is a bit zealous about it, and has no way of telling if the allocations are really an issue or not (and we will not add annotations to teach it).

/cc @bradleyfalzon who implemented the check
/cc @dgryski who has experience with the check on an internal code base and could tell us how useful the check was

from go-tools.

bradleyfalzon avatar bradleyfalzon commented on May 29, 2024

Certainly if there's false positive, IMHO staticcheck should not continue the check, especially if it doesn't catch a major bug.

However, as the check is already marked as dubious, and if it's just a matter of excluding interfaces from the check, it looks straight forward to add an if condition (or add to the existing) checking the argument is not an interface using !types.IsInterface(arg.Value.Value.Type()) or similar, I'd be happy to PR that.

But it's then up to @dominikh if he wants to continue maintaining this.

For the record, implemented via dominikh/go-staticcheck#11 and discussed in dominikh/go-staticcheck#10 but the go vet inclusion discussion has more information golang/go#16311.

from go-tools.

dominikh avatar dominikh commented on May 29, 2024

I'll close this issue. The reported bug has been fixed, and we'll keep the check for now.

from go-tools.

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.