Skip to content

exitAfterDefer: false positive #1421

@wipe2238

Description

@wipe2238

Using latest golangci-lint, found something which looks like false positive
Possibly related: #995

        var Response *http.Response
	if Response, Error = client.Do(Request); Error == nil {
		defer Response.Body.Close()
	} else {
		fmt.Println("[client.Do]", Error)
		os.Exit(1)
	}
cmd\GitHubReleasesAssets\json.go:41:3: exitAfterDefer: os.Exit will exit, and `defer Response.Body.Close()` will not run (gocritic)
                os.Exit(1)
                ^

If snippet is not enough, source can be found here

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions