Skip to content
This repository was archived by the owner on May 9, 2021. It is now read-only.
This repository was archived by the owner on May 9, 2021. It is now read-only.

golint doesn't require comment for "exported" methods of unexported types #253

@jim-minter

Description

@jim-minter

In the following example, golint does not require a comment on foo.Bar(). This decision is implemented at https://github.com/golang/lint/blob/master/lint.go#L819-L821. I think golint should require a comment, either for all "exported" methods of unexported types, or for methods of unexported types which constitute an exported interface, or for each method indicated in an exported interface definition (i.e. under type Foo interface).

package test

// Foo -- this comment is required by golint
type Foo interface {
    Bar()
}

type foo struct {
}

// Bar -- this comment is *not* required by golint
func (f *foo) Bar() {
}

// NewFoo -- this comment is required by golint
func NewFoo() Foo {
    return &foo{}
}

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