-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix various linting issues #2974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
02fb18e
libcontainer/user: remove unused ErrUnsupported
thaJeztah c064304
libcontainer/apparmor: split api (exported) from implementation
thaJeztah e204d6a
libcontainer/configs: add / fix godoc (golint)
thaJeztah 81fc5c8
libcontainer/user: fix capitalization (golint)
thaJeztah 340fdd9
libcontainer/nsenter: fix captalization (golint)
thaJeztah 9be156c
libcontainer/devices: fix godoc (golint)
thaJeztah c2416fb
libcontainer/system: fix godoc (golint)
thaJeztah 1fb56f9
libcontainer/cgroups/devices: if block ends with a return statement
thaJeztah 3e1bcb1
libcontainer/keys: var should be sessKeyID/ringID (golint)
thaJeztah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package apparmor | ||
|
|
||
| import "errors" | ||
|
|
||
| var ( | ||
| // IsEnabled returns true if apparmor is enabled for the host. | ||
| IsEnabled = isEnabled | ||
|
|
||
| // ApplyProfile will apply the profile with the specified name to the process after | ||
| // the next exec. It is only supported on Linux and produces an ErrApparmorNotEnabled | ||
| // on other platforms. | ||
| ApplyProfile = applyProfile | ||
|
|
||
| // ErrApparmorNotEnabled indicates that AppArmor is not enabled or not supported. | ||
| ErrApparmorNotEnabled = errors.New("apparmor: config provided but apparmor not supported") | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,19 +11,17 @@ import ( | |
| ) | ||
|
|
||
| const ( | ||
| minId = 0 | ||
| maxId = 1<<31 - 1 // for 32-bit systems compatibility | ||
| minID = 0 | ||
| maxID = 1<<31 - 1 // for 32-bit systems compatibility | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I have a similar change in #2975 |
||
| ) | ||
|
|
||
| var ( | ||
| // The current operating system does not provide the required data for user lookups. | ||
| ErrUnsupported = errors.New("user lookup: operating system does not provide passwd-formatted data") | ||
|
|
||
| // No matching entries found in file. | ||
| // ErrNoPasswdEntries is returned if no matching entries were found in /etc/group. | ||
| ErrNoPasswdEntries = errors.New("no matching entries in passwd file") | ||
| ErrNoGroupEntries = errors.New("no matching entries in group file") | ||
|
|
||
| ErrRange = fmt.Errorf("uids and gids must be in range %d-%d", minId, maxId) | ||
| // ErrNoGroupEntries is returned if no matching entries were found in /etc/passwd. | ||
| ErrNoGroupEntries = errors.New("no matching entries in group file") | ||
| // ErrRange is returned if a UID or GID is outside of the valid range. | ||
| ErrRange = fmt.Errorf("uids and gids must be in range %d-%d", minID, maxID) | ||
| ) | ||
|
|
||
| type User struct { | ||
|
|
@@ -328,7 +326,7 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) ( | |
| user.Uid = uidArg | ||
|
|
||
| // Must be inside valid uid range. | ||
| if user.Uid < minId || user.Uid > maxId { | ||
| if user.Uid < minID || user.Uid > maxID { | ||
| return nil, ErrRange | ||
| } | ||
|
|
||
|
|
@@ -377,7 +375,7 @@ func GetExecUser(userSpec string, defaults *ExecUser, passwd, group io.Reader) ( | |
| user.Gid = gidArg | ||
|
|
||
| // Must be inside valid gid range. | ||
| if user.Gid < minId || user.Gid > maxId { | ||
| if user.Gid < minID || user.Gid > maxID { | ||
| return nil, ErrRange | ||
| } | ||
|
|
||
|
|
@@ -439,7 +437,7 @@ func GetAdditionalGroups(additionalGroups []string, group io.Reader) ([]int, err | |
| return nil, fmt.Errorf("Unable to find group %s", ag) | ||
| } | ||
| // Ensure gid is inside gid range. | ||
| if gid < minId || gid > maxId { | ||
| if gid < minID || gid > maxID { | ||
| return nil, ErrRange | ||
| } | ||
| gidMap[int(gid)] = struct{}{} | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.