Skip to content

bedakb/nomainreturn

Repository files navigation

nomainreturn

A Go linter that checks for return statements in the main.

Install

go get github.com/bedakb/nomainreturn

Usage

nomainreturn ./...

Example

The purpose of this linter is to prevent accidental exits with 0 status code by using return.

package main

import (
    "fmt"

    log "github.com/sirupsen/logrus"
)

func main() {
    fmt.Println("running the program")

    if err := errnousFunc(); err != nil {
        log.WithError(err).Error("error occurred")
        return // exits with code 0
    }

    fmt.Println("done")
}

About

A Go linter that checks for return statements in the main

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages