Skip to content

var-naming: Go stdlib collision check breaks defaulting to golint behavior #1602

@chaimleib

Description

@chaimleib

Describe the bug
The RULES_DESCRIPTIONS.md promises about the var-naming rule:

By default, the rule behaves exactly as the alternative in golint but optionally, you can relax it (see golang/lint#89).

However, the new v1.13.0 behavior of skipPackageNameCollisionWithGoStd conflicts with that promise, making our behavior stricter than the original.

Given the following folder structure:

http/
    http.go

And given the following content of http.go:

# Package http contains helpers.
package http

The original behavior of golint gives no errors.

$ go install golang.org/x/lint/golint@latest
$ cd http
$ golint .

To Reproduce
Steps to reproduce the behavior:

  1. I updated revive go install github.com/mgechev/revive@latest
  2. I run it with no flags & no configuration file, inside the http folder described above:
revive .

Expected behavior
No errors.

Logs

http.go:2:9: avoid package names that conflict with Go standard library package names

Desktop (please complete the following information):

  • OS: Fedora 43
  • Version of Go: 1.25.4

Additional context
The last version of revive with the expected behavior is v1.12.0.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions