Skip to content

golangci-lint fails because modified files exist on the same path as go.mod (flat project structure) #604

@shackra

Description

@shackra

working on gitlab.com/shackra/goimapnotify, my project has a flat structure and the files I've changed exist in the root of the project, so the hook runs something like this:

golangci-lint run ./"."

which triggers a bunch of false positives:

golangci-lint............................................................Failed
- hook id: golangci-lint
- exit code: 1

xoauth2.go:69:47: undefined: sasl (typecheck)
func NewXoauth2Client(username, token string) sasl.Client {
                                              ^
client.go:112:34: undefined: sasl (typecheck)
		okBearer, err := c.SupportAuth(sasl.OAuthBearer)
		                               ^
client.go:126:19: undefined: sasl (typecheck)
			sasl_oauth := &sasl.OAuthBearerOptions{
			               ^
config.go:210:17: client.Logout undefined (type *IMAPIDLEClient has no field or method Logout) (typecheck)
			defer client.Logout()
			             ^
config.go:213:21: undefined: imap (typecheck)
			ch := make(chan *imap.MailboxInfo)
			                 ^
config.go:215:19: client.List undefined (type *IMAPIDLEClient has no field or method List) (typecheck)
				err := client.List("", "*", ch)
				              ^
watch.go:59:26: w.client.Select undefined (type *IMAPIDLEClient has no field or method Select) (typecheck)
	status, err := w.client.Select(w.box.Mailbox, true)
	                        ^
watch.go:70:11: w.client.Updates undefined (type *IMAPIDLEClient has no field or method Updates) (typecheck)
	w.client.Updates = updates
	         ^
watch.go:74:20: w.client.IdleWithFallback undefined (type *IMAPIDLEClient has no field or method IdleWithFallback) (typecheck)
		done <- w.client.IdleWithFallback(w.quit, 0) // 0 = good default
		                 ^
watch.go:90:24: w.client.LoggedOut undefined (type *IMAPIDLEClient has no field or method LoggedOut) (typecheck)
	kickedOut := w.client.LoggedOut()

if I run golangci-lint from the terminal, I get 0 issues:

➜  golangci-lint run --timeout 60s
0 issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions