Skip to content

Restricting methods with <package>.<type>.<method> doesn't work if return value is directly accessed #34

@dejan-lokar

Description

@dejan-lokar

I'm using the linter to restrict the GORM Raw method. I run the linter with golangci-lint 1.53.2. The forbidigo configuration is:

  forbidigo:
    analyze-types: true
    forbid:
      - p: gorm.DB.Raw
        msg: Example message.

Running the linter on the following example code it recognizes the first two instances but not the last one:

	var db *gorm.DB
	_ = db.Raw("...")
	_ = db.Session(nil).Raw("...")
	_ = db.Raw("...").Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions