GithubHelp home page GithubHelp logo

pombredanne / go-nyet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from barakmich/go-nyet

0.0 0.0 0.0 237 KB

More aggressive `go vet`

License: BSD 2-Clause "Simplified" License

Go 91.01% Emacs Lisp 3.05% Vim Script 5.94%

go-nyet's Introduction

DEPRECATED

Shadow catching is now part of go tool vet

go tool vet -shadow=true ./

Does what you want now. Make sure to run it separately from the standard go vet So you probably want:

go tool vet ./
go tool vet -shadow ./

In your relevant configuration.

Note that it does not ignore error types. But this is more strict anyway.


go-nyet

More aggressive go vet

Why?

I've been bitten by too many bugs caused by the shadowing of Go variables within subblocks. The time has come to end them once and for all.

What does it do?

It checks for shadowed variables anywhere they appear in the code. Helpfully, it also type checks these variables and ignores anything of type error. This is because it's very common practice to shadow err and, well, shadowing error typed things hasn't hurt me nearly as much in the past.

It also checks for clobbering of variables that occur that aren't technically shadows. Eg:

package main

import "os"

func main() {
    f, err := os.Open("")
    f, err = os.Open("")
    println(f, err)
}

Other aggressive checks may come in the future.

How do I get it?

go get github.com/barakmich/go-nyet

And run

go-nyet ./...
# or
go-nyet subpackage
# or
go-nyet file.go

In the root of your project. If it complains about packages, you may need to go install them first.

Still working out the kinks, but give it a shot.

License

BSD

go-nyet's People

Contributors

barakmich avatar bdarnell avatar tamird avatar

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.