-
Notifications
You must be signed in to change notification settings - Fork 944
bugfix: fix deadcode reports by gometalinter #2426
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -373,45 +373,17 @@ func setupNamespaces(ctx context.Context, c *Container, specWrapper *SpecWrapper | |
| return setupUtsNamespace(ctx, c, specWrapper) | ||
| } | ||
|
|
||
| // isEmpty indicates whether namespace mode is empty. | ||
|
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. cc @Ace-Tang to check this part. |
||
| func isEmpty(mode string) bool { | ||
| return mode == "" | ||
| } | ||
|
|
||
| // isNone indicates whether container's namespace mode is set to "none". | ||
| func isNone(mode string) bool { | ||
| return mode == "none" | ||
| } | ||
|
|
||
| // isHost indicates whether the container shares the host's corresponding namespace. | ||
| func isHost(mode string) bool { | ||
| return mode == "host" | ||
| } | ||
|
|
||
| // isShareable indicates whether the containers namespace can be shared with another container. | ||
| func isShareable(mode string) bool { | ||
| return mode == "shareable" | ||
| } | ||
|
|
||
| // isContainer indicates whether the container uses another container's corresponding namespace. | ||
| func isContainer(mode string) bool { | ||
| parts := strings.SplitN(mode, ":", 2) | ||
| return len(parts) > 1 && parts[0] == "container" | ||
| } | ||
|
|
||
| // isPrivate indicates whether the container uses its own namespace. | ||
| func isPrivate(ns specs.LinuxNamespaceType, mode string) bool { | ||
| switch ns { | ||
| case specs.IPCNamespace: | ||
| return mode == "private" | ||
| case specs.NetworkNamespace, specs.PIDNamespace: | ||
| return !(isHost(mode) || isContainer(mode)) | ||
| case specs.UserNamespace, specs.UTSNamespace: | ||
| return !(isHost(mode)) | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| // connectedContainer is the id or name of the container whose namespace this container share with. | ||
| func connectedContainer(mode string) string { | ||
| parts := strings.SplitN(mode, ":", 2) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ import ( | |
| "github.com/alibaba/pouch/daemon/config" | ||
| "github.com/alibaba/pouch/lxcfs" | ||
| "github.com/alibaba/pouch/pkg/debug" | ||
| "github.com/alibaba/pouch/pkg/exec" | ||
| "github.com/alibaba/pouch/pkg/utils" | ||
| "github.com/alibaba/pouch/storage/quota" | ||
| "github.com/alibaba/pouch/version" | ||
|
|
@@ -258,23 +257,6 @@ func initLog() { | |
| logrus.SetFormatter(formatter) | ||
| } | ||
|
|
||
| // define lxcfs processe. | ||
| func setLxcfsProcess(processes exec.Processes) exec.Processes { | ||
|
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. cc @CodeJuan to check lxcfs part. |
||
| if !cfg.IsLxcfsEnabled { | ||
| return processes | ||
| } | ||
|
|
||
| p := &exec.Process{ | ||
| Path: cfg.LxcfsBinPath, | ||
| Args: []string{ | ||
| cfg.LxcfsHome, | ||
| }, | ||
| } | ||
| processes = append(processes, p) | ||
|
|
||
| return processes | ||
| } | ||
|
|
||
| // check lxcfs config | ||
| func checkLxcfsCfg() error { | ||
| if !cfg.IsLxcfsEnabled { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,6 @@ import ( | |
| "github.com/sirupsen/logrus" | ||
| ) | ||
|
|
||
| var ( | ||
|
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. cc @rudyfly to check quota part. |
||
| grpQuotaType = "grpquota" | ||
| ) | ||
|
|
||
| // GrpQuotaDriver represents group quota driver. | ||
| type GrpQuotaDriver struct { | ||
| lock sync.Mutex | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.