Skip to content
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

Switch from gometalinter to golangci-lint #3411

Merged
merged 2 commits into from Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions .golangci.yml
@@ -0,0 +1,21 @@
linters:
enable:
- structcheck
- varcheck
- staticcheck
- unconvert
- gofmt
- goimports
- golint
- ineffassign
- vet
- unused
- misspell
disable:
- errcheck

run:
skip-dirs:
- api
- design
- docs
23 changes: 0 additions & 23 deletions .gometalinter.json

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -121,7 +121,7 @@ all: binaries

check: proto-fmt ## run all linters
@echo "$(WHALE) $@"
gometalinter --config .gometalinter.json ./...
golangci-lint run

ci: check binaries checkprotos coverage coverage-integration ## to be used by the CI

Expand Down
2 changes: 1 addition & 1 deletion cmd/containerd-shim-runc-v1/main.go
Expand Up @@ -19,7 +19,7 @@
package main

import (
"github.com/containerd/containerd/runtime/v2/runc/v1"
v1 "github.com/containerd/containerd/runtime/v2/runc/v1"
"github.com/containerd/containerd/runtime/v2/shim"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/containerd-shim-runc-v2/main.go
Expand Up @@ -19,7 +19,7 @@
package main

import (
"github.com/containerd/containerd/runtime/v2/runc/v2"
v2 "github.com/containerd/containerd/runtime/v2/runc/v2"
"github.com/containerd/containerd/runtime/v2/shim"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/ctr/commands/events/events.go
Expand Up @@ -47,7 +47,7 @@ var Command = cli.Command{
var e *events.Envelope
select {
case e = <-eventsCh:
case err, open = <-errCh:
case err = <-errCh:
Copy link
Member

Choose a reason for hiding this comment

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

it seems that we can remove the open var here because open always is true

return err
}
if e != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ctr/commands/plugins/plugins.go
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/cmd/ctr/commands"
"github.com/containerd/containerd/platforms"
"github.com/opencontainers/image-spec/specs-go/v1"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/urfave/cli"
"google.golang.org/grpc/codes"
)
Expand Down
2 changes: 1 addition & 1 deletion images/archive/reference.go
Expand Up @@ -91,7 +91,7 @@ func familiarizeReference(ref string) (string, error) {
func ociReferenceName(name string) string {
// OCI defines the reference name as only a tag excluding the
// repository. The containerd annotation contains the full image name
// since the tag is insufficent for correctly naming and referring to an
// since the tag is insufficient for correctly naming and referring to an
// image
var ociRef string
if spec, err := reference.Parse(name); err == nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/progress/escape.go
Expand Up @@ -19,6 +19,6 @@ package progress
const (
escape = "\x1b"
reset = escape + "[0m"
red = escape + "[31m" // nolint: staticcheck, varcheck
red = escape + "[31m" // nolint: deadcode, varcheck, unused
green = escape + "[32m"
)
2 changes: 1 addition & 1 deletion runtime/v2/binary.go
Expand Up @@ -87,7 +87,7 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_
defer f.Close()
if _, err := io.Copy(os.Stderr, f); err != nil {
// When using a multi-container shim the 2nd to Nth container in the
// shim will not have a seperate log pipe. Ignore the failure log
// shim will not have a separate log pipe. Ignore the failure log
// message here when the shim connect times out.
if !os.IsNotExist(errors.Cause(err)) {
log.G(ctx).WithError(err).Error("copy shim log")
Expand Down
2 changes: 1 addition & 1 deletion runtime/v2/runc/container.go
Expand Up @@ -261,7 +261,7 @@ func (c *Container) Process(id string) (process.Process, error) {
// ReserveProcess checks for the existence of an id and atomically
// reserves the process id if it does not already exist
//
// Returns true if the process id was sucessfully reserved and a
// Returns true if the process id was successfully reserved and a
// cancel func to release the reservation
func (c *Container) ReserveProcess(id string) (bool, func()) {
c.mu.Lock()
Expand Down
2 changes: 1 addition & 1 deletion runtime/v2/shim.go
Expand Up @@ -79,7 +79,7 @@ func loadShim(ctx context.Context, bundle *Bundle, events *exchange.Exchange, rt
defer f.Close()
if _, err := io.Copy(os.Stderr, f); err != nil {
// When using a multi-container shim the 2nd to Nth container in the
// shim will not have a seperate log pipe. Ignore the failure log
// shim will not have a separate log pipe. Ignore the failure log
// message here when the shim connect times out.
if !os.IsNotExist(errors.Cause(err)) {
log.G(ctx).WithError(err).Error("copy shim log")
Expand Down
3 changes: 1 addition & 2 deletions script/setup/install-dev-tools
Expand Up @@ -21,6 +21,5 @@
set -eu -o pipefail

go get -u github.com/stevvooe/protobuild
go get -u github.com/alecthomas/gometalinter
gometalinter --install >/dev/null
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
go get -u github.com/cpuguy83/go-md2man
2 changes: 1 addition & 1 deletion services/tasks/local.go
Expand Up @@ -43,7 +43,7 @@ import (
"github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/runtime"
"github.com/containerd/containerd/runtime/linux/runctypes"
"github.com/containerd/containerd/runtime/v2"
v2 "github.com/containerd/containerd/runtime/v2"
"github.com/containerd/containerd/runtime/v2/runc/options"
"github.com/containerd/containerd/services"
"github.com/containerd/typeurl"
Expand Down
2 changes: 1 addition & 1 deletion windows/task.go
Expand Up @@ -283,7 +283,7 @@ func (t *task) Update(ctx context.Context, resources *types.Any) error {

func (t *task) Process(ctx context.Context, id string) (p runtime.Process, err error) {
p = t.getProcess(id)
if p == nil {
if p == nil { // nolint: govet
err = errors.Wrapf(errdefs.ErrNotFound, "no such process %s", id)
}

Expand Down