Add interfacer and unconvert linters
| ... | ... |
@@ -18,7 +18,7 @@ type execBackend interface {
|
| 18 | 18 |
ContainerExecCreate(name string, config *types.ExecConfig) (string, error) |
| 19 | 19 |
ContainerExecInspect(id string) (*backend.ExecInspect, error) |
| 20 | 20 |
ContainerExecResize(name string, height, width int) error |
| 21 |
- ContainerExecStart(ctx context.Context, name string, stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) error |
|
| 21 |
+ ContainerExecStart(ctx context.Context, name string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error |
|
| 22 | 22 |
ExecExists(name string) (bool, error) |
| 23 | 23 |
} |
| 24 | 24 |
|
| ... | ... |
@@ -70,7 +70,7 @@ func (s *containerRouter) getContainersStats(ctx context.Context, w http.Respons |
| 70 | 70 |
config := &backend.ContainerStatsConfig{
|
| 71 | 71 |
Stream: stream, |
| 72 | 72 |
OutStream: w, |
| 73 |
- Version: string(httputils.VersionFromContext(ctx)), |
|
| 73 |
+ Version: httputils.VersionFromContext(ctx), |
|
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
return s.backend.ContainerStats(ctx, vars["name"], config) |
| ... | ... |
@@ -66,9 +66,7 @@ func (s *imageRouter) postCommit(ctx context.Context, w http.ResponseWriter, r * |
| 66 | 66 |
return err |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 |
- return httputils.WriteJSON(w, http.StatusCreated, &types.IDResponse{
|
|
| 70 |
- ID: string(imgID), |
|
| 71 |
- }) |
|
| 69 |
+ return httputils.WriteJSON(w, http.StatusCreated, &types.IDResponse{ID: imgID})
|
|
| 72 | 70 |
} |
| 73 | 71 |
|
| 74 | 72 |
// Creates an image from Pull or from Import |
| ... | ... |
@@ -2,6 +2,7 @@ package swarm |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 |
+ "io" |
|
| 5 | 6 |
"net/http" |
| 6 | 7 |
|
| 7 | 8 |
"github.com/docker/docker/api/server/httputils" |
| ... | ... |
@@ -12,7 +13,7 @@ import ( |
| 12 | 12 |
|
| 13 | 13 |
// swarmLogs takes an http response, request, and selector, and writes the logs |
| 14 | 14 |
// specified by the selector to the response |
| 15 |
-func (sr *swarmRouter) swarmLogs(ctx context.Context, w http.ResponseWriter, r *http.Request, selector *backend.LogSelector) error {
|
|
| 15 |
+func (sr *swarmRouter) swarmLogs(ctx context.Context, w io.Writer, r *http.Request, selector *backend.LogSelector) error {
|
|
| 16 | 16 |
// Args are validated before the stream starts because when it starts we're |
| 17 | 17 |
// sending HTTP 200 by writing an empty chunk of data to tell the client that |
| 18 | 18 |
// daemon is going to stream. By sending this initial HTTP 200 we can't report |
| ... | ... |
@@ -555,7 +555,7 @@ func parseOptInterval(f *Flag) (time.Duration, error) {
|
| 555 | 555 |
if err != nil {
|
| 556 | 556 |
return 0, err |
| 557 | 557 |
} |
| 558 |
- if d < time.Duration(container.MinimumDuration) {
|
|
| 558 |
+ if d < container.MinimumDuration {
|
|
| 559 | 559 |
return 0, fmt.Errorf("Interval %#v cannot be less than %s", f.name, container.MinimumDuration)
|
| 560 | 560 |
} |
| 561 | 561 |
return d, nil |
| ... | ... |
@@ -348,7 +348,7 @@ func (b *Builder) probeCache(dispatchState *dispatchState, runConfig *container. |
| 348 | 348 |
} |
| 349 | 349 |
fmt.Fprint(b.Stdout, " ---> Using cache\n") |
| 350 | 350 |
|
| 351 |
- dispatchState.imageID = string(cachedID) |
|
| 351 |
+ dispatchState.imageID = cachedID |
|
| 352 | 352 |
b.buildStages.update(dispatchState.imageID) |
| 353 | 353 |
return true, nil |
| 354 | 354 |
} |
| ... | ... |
@@ -110,7 +110,7 @@ func GetWithStatusError(address string) (resp *http.Response, err error) {
|
| 110 | 110 |
// - an io.Reader for the response body |
| 111 | 111 |
// - an error value which will be non-nil either when something goes wrong while |
| 112 | 112 |
// reading bytes from r or when the detected content-type is not acceptable. |
| 113 |
-func inspectResponse(ct string, r io.ReadCloser, clen int64) (string, io.ReadCloser, error) {
|
|
| 113 |
+func inspectResponse(ct string, r io.Reader, clen int64) (string, io.ReadCloser, error) {
|
|
| 114 | 114 |
plen := clen |
| 115 | 115 |
if plen <= 0 || plen > maxPreambleLength {
|
| 116 | 116 |
plen = maxPreambleLength |
| ... | ... |
@@ -119,10 +119,10 @@ func inspectResponse(ct string, r io.ReadCloser, clen int64) (string, io.ReadClo |
| 119 | 119 |
preamble := make([]byte, plen, plen) |
| 120 | 120 |
rlen, err := r.Read(preamble) |
| 121 | 121 |
if rlen == 0 {
|
| 122 |
- return ct, r, errors.New("empty response")
|
|
| 122 |
+ return ct, ioutil.NopCloser(r), errors.New("empty response")
|
|
| 123 | 123 |
} |
| 124 | 124 |
if err != nil && err != io.EOF {
|
| 125 |
- return ct, r, err |
|
| 125 |
+ return ct, ioutil.NopCloser(r), err |
|
| 126 | 126 |
} |
| 127 | 127 |
|
| 128 | 128 |
preambleR := bytes.NewReader(preamble[:rlen]) |
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
"github.com/docker/distribution/reference" |
| 8 | 8 |
"github.com/docker/docker/api/types" |
| 9 | 9 |
"github.com/docker/docker/api/types/swarm" |
| 10 |
- "github.com/opencontainers/go-digest" |
|
| 10 |
+ digest "github.com/opencontainers/go-digest" |
|
| 11 | 11 |
"github.com/pkg/errors" |
| 12 | 12 |
"golang.org/x/net/context" |
| 13 | 13 |
) |
| ... | ... |
@@ -85,7 +85,7 @@ func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, |
| 85 | 85 |
return response, err |
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 |
-func imageDigestAndPlatforms(ctx context.Context, cli *Client, image, encodedAuth string) (string, []swarm.Platform, error) {
|
|
| 88 |
+func imageDigestAndPlatforms(ctx context.Context, cli DistributionAPIClient, image, encodedAuth string) (string, []swarm.Platform, error) {
|
|
| 89 | 89 |
distributionInspect, err := cli.DistributionInspect(ctx, image, encodedAuth) |
| 90 | 90 |
imageWithDigest := image |
| 91 | 91 |
var platforms []swarm.Platform |
| ... | ... |
@@ -539,7 +539,7 @@ func initRouter(opts routerOptions) {
|
| 539 | 539 |
} |
| 540 | 540 |
|
| 541 | 541 |
// TODO: remove this from cli and return the authzMiddleware |
| 542 |
-func (cli *DaemonCli) initMiddlewares(s *apiserver.Server, cfg *apiserver.Config, pluginStore *plugin.Store) error {
|
|
| 542 |
+func (cli *DaemonCli) initMiddlewares(s *apiserver.Server, cfg *apiserver.Config, pluginStore plugingetter.PluginGetter) error {
|
|
| 543 | 543 |
v := cfg.Version |
| 544 | 544 |
|
| 545 | 545 |
exp := middleware.NewExperimentalMiddleware(cli.Config.Experimental) |
| ... | ... |
@@ -655,8 +655,12 @@ func (container *Container) BuildEndpointInfo(n libnetwork.Network, ep libnetwor |
| 655 | 655 |
return nil |
| 656 | 656 |
} |
| 657 | 657 |
|
| 658 |
+type named interface {
|
|
| 659 |
+ Name() string |
|
| 660 |
+} |
|
| 661 |
+ |
|
| 658 | 662 |
// UpdateJoinInfo updates network settings when container joins network n with endpoint ep. |
| 659 |
-func (container *Container) UpdateJoinInfo(n libnetwork.Network, ep libnetwork.Endpoint) error {
|
|
| 663 |
+func (container *Container) UpdateJoinInfo(n named, ep libnetwork.Endpoint) error {
|
|
| 660 | 664 |
if err := container.buildPortMapInfo(ep); err != nil {
|
| 661 | 665 |
return err |
| 662 | 666 |
} |
| ... | ... |
@@ -684,7 +688,7 @@ func (container *Container) UpdateSandboxNetworkSettings(sb libnetwork.Sandbox) |
| 684 | 684 |
} |
| 685 | 685 |
|
| 686 | 686 |
// BuildJoinOptions builds endpoint Join options from a given network. |
| 687 |
-func (container *Container) BuildJoinOptions(n libnetwork.Network) ([]libnetwork.EndpointOption, error) {
|
|
| 687 |
+func (container *Container) BuildJoinOptions(n named) ([]libnetwork.EndpointOption, error) {
|
|
| 688 | 688 |
var joinOptions []libnetwork.EndpointOption |
| 689 | 689 |
if epConfig, ok := container.NetworkSettings.Networks[n.Name()]; ok {
|
| 690 | 690 |
for _, str := range epConfig.Links {
|
| ... | ... |
@@ -3,7 +3,6 @@ package convert |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"strings" |
| 6 |
- "time" |
|
| 7 | 6 |
|
| 8 | 7 |
types "github.com/docker/docker/api/types/swarm" |
| 9 | 8 |
swarmapi "github.com/docker/swarmkit/api" |
| ... | ... |
@@ -115,7 +114,7 @@ func MergeSwarmSpecToGRPC(s types.Spec, spec swarmapi.ClusterSpec) (swarmapi.Clu |
| 115 | 115 |
spec.Raft.ElectionTick = uint32(s.Raft.ElectionTick) |
| 116 | 116 |
} |
| 117 | 117 |
if s.Dispatcher.HeartbeatPeriod != 0 {
|
| 118 |
- spec.Dispatcher.HeartbeatPeriod = gogotypes.DurationProto(time.Duration(s.Dispatcher.HeartbeatPeriod)) |
|
| 118 |
+ spec.Dispatcher.HeartbeatPeriod = gogotypes.DurationProto(s.Dispatcher.HeartbeatPeriod) |
|
| 119 | 119 |
} |
| 120 | 120 |
if s.CAConfig.NodeCertExpiry != 0 {
|
| 121 | 121 |
spec.CAConfig.NodeCertExpiry = gogotypes.DurationProto(s.CAConfig.NodeCertExpiry) |
| ... | ... |
@@ -142,7 +142,7 @@ func (d *Daemon) ContainerExecCreate(name string, config *types.ExecConfig) (str |
| 142 | 142 |
// ContainerExecStart starts a previously set up exec instance. The |
| 143 | 143 |
// std streams are set up. |
| 144 | 144 |
// If ctx is cancelled, the process is terminated. |
| 145 |
-func (d *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) (err error) {
|
|
| 145 |
+func (d *Daemon) ContainerExecStart(ctx context.Context, name string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (err error) {
|
|
| 146 | 146 |
var ( |
| 147 | 147 |
cStdin io.ReadCloser |
| 148 | 148 |
cStdout, cStderr io.Writer |
| ... | ... |
@@ -158,8 +158,8 @@ func copyDir(srcDir, dstDir string, flags copyFlags) error {
|
| 158 | 158 |
|
| 159 | 159 |
// system.Chtimes doesn't support a NOFOLLOW flag atm |
| 160 | 160 |
if !isSymlink {
|
| 161 |
- aTime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) |
|
| 162 |
- mTime := time.Unix(int64(stat.Mtim.Sec), int64(stat.Mtim.Nsec)) |
|
| 161 |
+ aTime := time.Unix(stat.Atim.Sec, stat.Atim.Nsec) |
|
| 162 |
+ mTime := time.Unix(stat.Mtim.Sec, stat.Mtim.Nsec) |
|
| 163 | 163 |
if err := system.Chtimes(dstPath, aTime, mTime); err != nil {
|
| 164 | 164 |
return err |
| 165 | 165 |
} |
| ... | ... |
@@ -97,10 +97,10 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
| 97 | 97 |
drivers = strings.TrimSpace(drivers) |
| 98 | 98 |
v := &types.Info{
|
| 99 | 99 |
ID: daemon.ID, |
| 100 |
- Containers: int(cRunning + cPaused + cStopped), |
|
| 101 |
- ContainersRunning: int(cRunning), |
|
| 102 |
- ContainersPaused: int(cPaused), |
|
| 103 |
- ContainersStopped: int(cStopped), |
|
| 100 |
+ Containers: cRunning + cPaused + cStopped, |
|
| 101 |
+ ContainersRunning: cRunning, |
|
| 102 |
+ ContainersPaused: cPaused, |
|
| 103 |
+ ContainersStopped: cStopped, |
|
| 104 | 104 |
Images: imageCount, |
| 105 | 105 |
Driver: drivers, |
| 106 | 106 |
DriverStatus: daemon.stores[p].layerStore.DriverStatus(), |
| ... | ... |
@@ -86,7 +86,7 @@ func listenFD(addr string, tlsConfig *tls.Config) ([]net.Listener, error) {
|
| 86 | 86 |
return nil, fmt.Errorf("failed to parse systemd fd address: should be a number: %v", addr)
|
| 87 | 87 |
} |
| 88 | 88 |
fdOffset := fdNum - 3 |
| 89 |
- if len(listeners) < int(fdOffset)+1 {
|
|
| 89 |
+ if len(listeners) < fdOffset+1 {
|
|
| 90 | 90 |
return nil, fmt.Errorf("too few socket activated files passed in by systemd")
|
| 91 | 91 |
} |
| 92 | 92 |
if listeners[fdOffset] == nil {
|
| ... | ... |
@@ -833,7 +833,7 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
|
| 833 | 833 |
s.Process.OOMScoreAdj = &c.HostConfig.OomScoreAdj |
| 834 | 834 |
s.Linux.MountLabel = c.MountLabel |
| 835 | 835 |
|
| 836 |
- return (*specs.Spec)(&s), nil |
|
| 836 |
+ return &s, nil |
|
| 837 | 837 |
} |
| 838 | 838 |
|
| 839 | 839 |
func clearReadOnly(m *specs.Mount) {
|
| ... | ... |
@@ -84,7 +84,7 @@ func ComputeV2MetadataHMACKey(authConfig *types.AuthConfig) ([]byte, error) {
|
| 84 | 84 |
if err != nil {
|
| 85 | 85 |
return nil, err |
| 86 | 86 |
} |
| 87 |
- return []byte(digest.FromBytes([]byte(buf))), nil |
|
| 87 |
+ return []byte(digest.FromBytes(buf)), nil |
|
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 | 90 |
// authConfigKeyInput is a reduced AuthConfig structure holding just relevant credential data eligible for |
| ... | ... |
@@ -28,7 +28,7 @@ import ( |
| 28 | 28 |
"github.com/docker/docker/pkg/system" |
| 29 | 29 |
refstore "github.com/docker/docker/reference" |
| 30 | 30 |
"github.com/docker/docker/registry" |
| 31 |
- "github.com/opencontainers/go-digest" |
|
| 31 |
+ digest "github.com/opencontainers/go-digest" |
|
| 32 | 32 |
"github.com/pkg/errors" |
| 33 | 33 |
"github.com/sirupsen/logrus" |
| 34 | 34 |
"golang.org/x/net/context" |
| ... | ... |
@@ -435,7 +435,7 @@ func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named) (tagUpdat |
| 435 | 435 |
return true, nil |
| 436 | 436 |
} |
| 437 | 437 |
|
| 438 |
-func (p *v2Puller) pullSchema1(ctx context.Context, ref reference.Named, unverifiedManifest *schema1.SignedManifest) (id digest.Digest, manifestDigest digest.Digest, err error) {
|
|
| 438 |
+func (p *v2Puller) pullSchema1(ctx context.Context, ref reference.Reference, unverifiedManifest *schema1.SignedManifest) (id digest.Digest, manifestDigest digest.Digest, err error) {
|
|
| 439 | 439 |
var verifiedManifest *schema1.Manifest |
| 440 | 440 |
verifiedManifest, err = verifySchema1Manifest(unverifiedManifest, ref) |
| 441 | 441 |
if err != nil {
|
| ... | ... |
@@ -838,7 +838,7 @@ func allowV1Fallback(err error) error {
|
| 838 | 838 |
return err |
| 839 | 839 |
} |
| 840 | 840 |
|
| 841 |
-func verifySchema1Manifest(signedManifest *schema1.SignedManifest, ref reference.Named) (m *schema1.Manifest, err error) {
|
|
| 841 |
+func verifySchema1Manifest(signedManifest *schema1.SignedManifest, ref reference.Reference) (m *schema1.Manifest, err error) {
|
|
| 842 | 842 |
// If pull by digest, then verify the manifest digest. NOTE: It is |
| 843 | 843 |
// important to do this first, before any other content validation. If the |
| 844 | 844 |
// digest cannot be verified, don't even bother with those other things. |
| ... | ... |
@@ -24,7 +24,7 @@ import ( |
| 24 | 24 |
"github.com/docker/docker/pkg/progress" |
| 25 | 25 |
"github.com/docker/docker/pkg/stringid" |
| 26 | 26 |
"github.com/docker/docker/registry" |
| 27 |
- "github.com/opencontainers/go-digest" |
|
| 27 |
+ digest "github.com/opencontainers/go-digest" |
|
| 28 | 28 |
"github.com/sirupsen/logrus" |
| 29 | 29 |
) |
| 30 | 30 |
|
| ... | ... |
@@ -651,6 +651,7 @@ func (bla byLikeness) Swap(i, j int) {
|
| 651 | 651 |
} |
| 652 | 652 |
func (bla byLikeness) Len() int { return len(bla.arr) }
|
| 653 | 653 |
|
| 654 |
+// nolint: interfacer |
|
| 654 | 655 |
func sortV2MetadataByLikenessAndAge(repoInfo reference.Named, hmacKey []byte, marr []metadata.V2Metadata) {
|
| 655 | 656 |
// reverse the metadata array to shift the newest entries to the beginning |
| 656 | 657 |
for i := 0; i < len(marr)/2; i++ {
|
| ... | ... |
@@ -23,7 +23,7 @@ import ( |
| 23 | 23 |
"github.com/docker/docker/pkg/stringid" |
| 24 | 24 |
"github.com/docker/docker/pkg/symlink" |
| 25 | 25 |
"github.com/docker/docker/pkg/system" |
| 26 |
- "github.com/opencontainers/go-digest" |
|
| 26 |
+ digest "github.com/opencontainers/go-digest" |
|
| 27 | 27 |
"github.com/sirupsen/logrus" |
| 28 | 28 |
) |
| 29 | 29 |
|
| ... | ... |
@@ -212,15 +212,12 @@ func (l *tarexporter) loadLayer(filename string, rootFS image.RootFS, id string, |
| 212 | 212 |
return l.ls.Register(inflatedLayerData, rootFS.ChainID(), platform) |
| 213 | 213 |
} |
| 214 | 214 |
|
| 215 |
-func (l *tarexporter) setLoadedTag(ref reference.NamedTagged, imgID digest.Digest, outStream io.Writer) error {
|
|
| 215 |
+func (l *tarexporter) setLoadedTag(ref reference.Named, imgID digest.Digest, outStream io.Writer) error {
|
|
| 216 | 216 |
if prevID, err := l.rs.Get(ref); err == nil && prevID != imgID {
|
| 217 | 217 |
fmt.Fprintf(outStream, "The image %s already exists, renaming the old one with ID %s to empty string\n", reference.FamiliarString(ref), string(prevID)) // todo: this message is wrong in case of multiple tags |
| 218 | 218 |
} |
| 219 | 219 |
|
| 220 |
- if err := l.rs.AddTag(ref, imgID, true); err != nil {
|
|
| 221 |
- return err |
|
| 222 |
- } |
|
| 223 |
- return nil |
|
| 220 |
+ return l.rs.AddTag(ref, imgID, true) |
|
| 224 | 221 |
} |
| 225 | 222 |
|
| 226 | 223 |
func (l *tarexporter) legacyLoad(tmpDir string, outStream io.Writer, progressOutput progress.Output) error {
|
| ... | ... |
@@ -50,7 +50,7 @@ func (clnt *client) Create(containerID string, checkpoint string, checkpointDir |
| 50 | 50 |
return fmt.Errorf("Container %s is already active", containerID)
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 |
- uid, gid, err := getRootIDs(specs.Spec(spec)) |
|
| 53 |
+ uid, gid, err := getRootIDs(spec) |
|
| 54 | 54 |
if err != nil {
|
| 55 | 55 |
return err |
| 56 | 56 |
} |
| ... | ... |
@@ -177,7 +177,7 @@ func (opts *MapOpts) GetAll() map[string]string {
|
| 177 | 177 |
} |
| 178 | 178 |
|
| 179 | 179 |
func (opts *MapOpts) String() string {
|
| 180 |
- return fmt.Sprintf("%v", map[string]string((opts.values)))
|
|
| 180 |
+ return fmt.Sprintf("%v", opts.values)
|
|
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 | 183 |
// Type returns a string name for this Option type |
| ... | ... |
@@ -50,8 +50,8 @@ func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat interface{}) (
|
| 50 | 50 |
// Currently go does not fill in the major/minors |
| 51 | 51 |
if s.Mode&unix.S_IFBLK != 0 || |
| 52 | 52 |
s.Mode&unix.S_IFCHR != 0 {
|
| 53 |
- hdr.Devmajor = int64(major(uint64(s.Rdev))) |
|
| 54 |
- hdr.Devminor = int64(minor(uint64(s.Rdev))) |
|
| 53 |
+ hdr.Devmajor = int64(major(s.Rdev)) |
|
| 54 |
+ hdr.Devminor = int64(minor(s.Rdev)) |
|
| 55 | 55 |
} |
| 56 | 56 |
} |
| 57 | 57 |
|
| ... | ... |
@@ -62,7 +62,7 @@ func getInodeFromStat(stat interface{}) (inode uint64, err error) {
|
| 62 | 62 |
s, ok := stat.(*syscall.Stat_t) |
| 63 | 63 |
|
| 64 | 64 |
if ok {
|
| 65 |
- inode = uint64(s.Ino) |
|
| 65 |
+ inode = s.Ino |
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
return |
| ... | ... |
@@ -294,7 +294,7 @@ func OverlayChanges(layers []string, rw string) ([]Change, error) {
|
| 294 | 294 |
func overlayDeletedFile(root, path string, fi os.FileInfo) (string, error) {
|
| 295 | 295 |
if fi.Mode()&os.ModeCharDevice != 0 {
|
| 296 | 296 |
s := fi.Sys().(*syscall.Stat_t) |
| 297 |
- if major(uint64(s.Rdev)) == 0 && minor(uint64(s.Rdev)) == 0 {
|
|
| 297 |
+ if major(s.Rdev) == 0 && minor(s.Rdev) == 0 {
|
|
| 298 | 298 |
return path, nil |
| 299 | 299 |
} |
| 300 | 300 |
} |
| ... | ... |
@@ -74,7 +74,7 @@ type DefaultLogger struct {
|
| 74 | 74 |
// DMLog is the logging callback containing all of the information from |
| 75 | 75 |
// devicemapper. The interface is identical to the C libdm counterpart. |
| 76 | 76 |
func (l DefaultLogger) DMLog(level int, file string, line, dmError int, message string) {
|
| 77 |
- if int(level) <= l.Level {
|
|
| 77 |
+ if level <= l.Level {
|
|
| 78 | 78 |
// Forward the log to the correct logrus level, if allowed by dmLogLevel. |
| 79 | 79 |
logMsg := fmt.Sprintf("libdevmapper(%d): %s:%d (%d) %s", level, file, line, dmError, message)
|
| 80 | 80 |
switch level {
|
| ... | ... |
@@ -34,11 +34,11 @@ func Size(dir string) (size int64, err error) {
|
| 34 | 34 |
// Check inode to handle hard links correctly |
| 35 | 35 |
inode := fileInfo.Sys().(*syscall.Stat_t).Ino |
| 36 | 36 |
// inode is not a uint64 on all platforms. Cast it to avoid issues. |
| 37 |
- if _, exists := data[uint64(inode)]; exists {
|
|
| 37 |
+ if _, exists := data[inode]; exists {
|
|
| 38 | 38 |
return nil |
| 39 | 39 |
} |
| 40 | 40 |
// inode is not a uint64 on all platforms. Cast it to avoid issues. |
| 41 |
- data[uint64(inode)] = struct{}{}
|
|
| 41 |
+ data[inode] = struct{}{}
|
|
| 42 | 42 |
|
| 43 | 43 |
size += s |
| 44 | 44 |
|
| ... | ... |
@@ -5,10 +5,10 @@ import "syscall" |
| 5 | 5 |
// fromStatT converts a syscall.Stat_t type to a system.Stat_t type |
| 6 | 6 |
func fromStatT(s *syscall.Stat_t) (*StatT, error) {
|
| 7 | 7 |
return &StatT{size: s.Size,
|
| 8 |
- mode: uint32(s.Mode), |
|
| 8 |
+ mode: s.Mode, |
|
| 9 | 9 |
uid: s.Uid, |
| 10 | 10 |
gid: s.Gid, |
| 11 |
- rdev: uint64(s.Rdev), |
|
| 11 |
+ rdev: s.Rdev, |
|
| 12 | 12 |
mtim: s.Mtim}, nil |
| 13 | 13 |
} |
| 14 | 14 |
|
| ... | ... |
@@ -18,7 +18,6 @@ import ( |
| 18 | 18 |
"github.com/docker/docker/pkg/stringid" |
| 19 | 19 |
"github.com/docker/docker/plugin/v2" |
| 20 | 20 |
"github.com/opencontainers/go-digest" |
| 21 |
- specs "github.com/opencontainers/runtime-spec/specs-go" |
|
| 22 | 21 |
"github.com/pkg/errors" |
| 23 | 22 |
"github.com/sirupsen/logrus" |
| 24 | 23 |
"golang.org/x/sys/unix" |
| ... | ... |
@@ -62,7 +61,7 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
|
| 62 | 62 |
return errors.WithStack(err) |
| 63 | 63 |
} |
| 64 | 64 |
|
| 65 |
- if err := pm.containerdClient.Create(p.GetID(), "", "", specs.Spec(*spec), attachToLog(p.GetID())); err != nil {
|
|
| 65 |
+ if err := pm.containerdClient.Create(p.GetID(), "", "", *spec, attachToLog(p.GetID())); err != nil {
|
|
| 66 | 66 |
if p.PropagatedMount != "" {
|
| 67 | 67 |
if err := mount.Unmount(p.PropagatedMount); err != nil {
|
| 68 | 68 |
logrus.Warnf("Could not unmount %s: %v", p.PropagatedMount, err)
|
| ... | ... |
@@ -247,6 +247,7 @@ func (err PingResponseError) Error() string {
|
| 247 | 247 |
// challenge manager for the supported authentication types and |
| 248 | 248 |
// whether v2 was confirmed by the response. If a response is received but |
| 249 | 249 |
// cannot be interpreted a PingResponseError will be returned. |
| 250 |
+// nolint: interfacer |
|
| 250 | 251 |
func PingV2Registry(endpoint *url.URL, transport http.RoundTripper) (challenge.Manager, bool, error) {
|
| 251 | 252 |
var ( |
| 252 | 253 |
foundV2 = false |