Skip to content

golint fixes for daemon/ package#15310

Merged
calavera merged 1 commit intomoby:masterfrom
MHBauer:demon-lint-squash
Aug 28, 2015
Merged

golint fixes for daemon/ package#15310
calavera merged 1 commit intomoby:masterfrom
MHBauer:demon-lint-squash

Conversation

@MHBauer
Copy link
Contributor

@MHBauer MHBauer commented Aug 4, 2015

One linter advice yet:
daemon/inspect.go:100:56: exported method ContainerExecInspect returns unexported type *daemon.execConfig, which can be annoying to use
Suggestions for addressing it?

There are a surprising (to me) amount of things that became non-exported.

There some comments with "perhaps" in them that I was not sure if I should take action on.

There are some renames with *Locking because all the functions did was add locking around an existing unexported function.

Some of the comments need work as to the exact details.

A partial history of individual commits can be found in my forked repo in the "split-commits" branch.

for #14756

@MHBauer
Copy link
Contributor Author

MHBauer commented Aug 4, 2015

I'm going to temporarily turn the linter off until it's agreed on how to implement the daemon/inspect.go advice.

Edit: linter is on now

@MHBauer MHBauer force-pushed the demon-lint-squash branch 2 times, most recently from 312c843 to 14feaad Compare August 5, 2015 00:19
@MHBauer
Copy link
Contributor Author

MHBauer commented Aug 5, 2015

fix for windows. kind of concerned that the cross compile did not fail. It should have built everything for Windows, right?

@MHBauer MHBauer force-pushed the demon-lint-squash branch 2 times, most recently from 6cdc4e0 to ef22f25 Compare August 5, 2015 21:31
@aaronlehmann
Copy link

I'd suggest exporting execConfig. Any type returned by an exported function should also be exported.

Choose a reason for hiding this comment

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

While we're at it, should this change to ErrContainerRootFSReadOnly? Or maybe something a little shorter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does that mean you agree on moving it?

For a rename, ErrRootFSReadOnly? I cannot think of a way to make that much shorter, and I do not think "Container" adds anything informative. Errors like this can also be replaced simply with fmt.errorf as well, because they have no internal variables, only a non-specific message.

Choose a reason for hiding this comment

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

I think it's good practice to export the errors that get returned so package users can check for them, so I'd lean towards leaving it exported. Moving it to the file where it's used sounds okay but I don't think it matters much.

ErrRootFSReadOnly sounds good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I understand why it does not matter where it is defined. I am still getting used to golang.

daemon/daemon.go Outdated

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, relic of my understanding embedding. Definitely putting that back. Thanks.

@MHBauer MHBauer force-pushed the demon-lint-squash branch 3 times, most recently from 37c215a to 2fb8cbc Compare August 21, 2015 18:42
Copy link
Member

Choose a reason for hiding this comment

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

I'm probably missing something here but : Why is this one rename ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is an already existing function in container_windows.go which causes a conflict if I downcase it.

@vdemeester
Copy link
Member

Hum, windows build is failing, setRestarting is re-defined somehow (state.go:217). This is probably due to : https://github.com/docker/docker/blob/9b8cfb6c79904bf74edae7c3fcc317e525f82fc7/daemon/state.go#L208 I think, but 😓..

@MHBauer MHBauer force-pushed the demon-lint-squash branch 2 times, most recently from 1cb0903 to 2b08b4d Compare August 24, 2015 19:28
@MHBauer
Copy link
Contributor Author

MHBauer commented Aug 24, 2015

Yea, bad rebase on my part. Fixing.

@MHBauer MHBauer force-pushed the demon-lint-squash branch 7 times, most recently from 72dfe94 to 67a54a1 Compare August 26, 2015 17:46
@LK4D4
Copy link
Contributor

LK4D4 commented Aug 27, 2015

@MHBauer would you mind to rebase. I promise to review!

@MHBauer MHBauer force-pushed the demon-lint-squash branch 4 times, most recently from c3081b5 to 20aa550 Compare August 27, 2015 23:25
 - some method names were changed to have a 'Locking' suffix, as the
 downcased versions already existed, and the existing functions simply
 had locks around the already downcased version.
 - deleting unused functions
 - package comment
 - magic numbers replaced by golang constants
 - comments all over

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
@MHBauer MHBauer force-pushed the demon-lint-squash branch from 20aa550 to abd72d4 Compare August 28, 2015 05:07
@LK4D4
Copy link
Contributor

LK4D4 commented Aug 28, 2015

LGTM
I think we can fix minor comments in other PRs, because this is really painful to rebase and it is indeed fixes all goling warnings.

@calavera
Copy link
Contributor

LGTM, brb, rebasing all my PRs that are affected by me merging this! 🎉

calavera added a commit that referenced this pull request Aug 28, 2015
@calavera calavera merged commit 433956c into moby:master Aug 28, 2015
@MHBauer MHBauer deleted the demon-lint-squash branch August 28, 2015 17:47
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.

8 participants