Skip to content

Add interfacer and unconvert linters#34625

Merged
yongtang merged 2 commits intomoby:masterfrom
dnephin:more-linters
Sep 1, 2017
Merged

Add interfacer and unconvert linters#34625
yongtang merged 2 commits intomoby:masterfrom
dnephin:more-linters

Conversation

@dnephin
Copy link
Copy Markdown
Member

@dnephin dnephin commented Aug 24, 2017

interfacer checks function arguments for types that could use a smaller interface
unconvert finds unnecessary type convertions

@dmcgowan
Copy link
Copy Markdown
Member

The 2 places where // nolint: interfacer is used a string could just be passed in instead. Would that be considered a functional change you are trying to avoid here?

@dnephin
Copy link
Copy Markdown
Member Author

dnephin commented Aug 24, 2017

Yes, I considered making that change, but I decided against it (at least for now). There are cases (like these) where I think it's actually better to accept a more specific type, even if it's only being used as a string, because it gives the caller more information about the supported values.

PingV2Registry is exported as well, so I didn't want to break any external consumers of that package (docker/cli for example) when they go to upgrade.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
ContainerExecInspect(id string) (*backend.ExecInspect, error)
ContainerExecResize(name string, height, width int) error
ContainerExecStart(ctx context.Context, name string, stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) error
ContainerExecStart(ctx context.Context, name string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error
Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 Aug 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems a bit strange.
I'd expect to need to close stdin if the exec/container process exits.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's what I was thinking too, but apparently that's not the case.

I'll take another look to find out why.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the caller is responsible for closing the the reader, which is why this isn't using ReadCloser

@dnephin
Copy link
Copy Markdown
Member Author

dnephin commented Aug 29, 2017

ping. Anything I should change here, or do my explanations make sense?

Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@yongtang yongtang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yongtang yongtang merged commit cb952bf into moby:master Sep 1, 2017
@dnephin dnephin deleted the more-linters branch September 1, 2017 16:01
@kolyshkin
Copy link
Copy Markdown
Contributor

I am seeing ARM build failure because of commit 2f5f0af, here's the error:

19:06:45 ---> Making bundle: dynbinary (in bundles/17.06.0-dev/dynbinary)
19:06:48 Building: bundles/17.06.0-dev/dynbinary-daemon/dockerd-17.06.0-dev
19:10:58 # github.com/docker/docker/daemon/graphdriver/overlay
19:10:58 daemon/graphdriver/overlay/copy.go:161: cannot use stat.Atim.Sec (type int32) as type int64 in argument to time.Unix
19:10:58 daemon/graphdriver/overlay/copy.go:161: cannot use stat.Atim.Nsec (type int32) as type int64 in argument to time.Unix
19:10:58 daemon/graphdriver/overlay/copy.go:162: cannot use stat.Mtim.Sec (type int32) as type int64 in argument to time.Unix
19:10:58 daemon/graphdriver/overlay/copy.go:162: cannot use stat.Mtim.Nsec (type int32) as type int64 in argument to time.Unix

dsheets pushed a commit to dsheets/moby that referenced this pull request Oct 11, 2017
interfacer linter was introduced in moby#34625.

Signed-off-by: David Sheets <dsheets@docker.com>
djs55 pushed a commit to djs55/docker that referenced this pull request Jan 19, 2018
interfacer linter was introduced in moby#34625.

Signed-off-by: David Sheets <dsheets@docker.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants