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

Failing lint job in tests #702

Closed
lbeckman314 opened this issue May 15, 2023 · 0 comments
Closed

Failing lint job in tests #702

lbeckman314 opened this issue May 15, 2023 · 0 comments
Assignees
Labels

Comments

@lbeckman314
Copy link
Member

lbeckman314 commented May 15, 2023

The lint job in tests.yaml fails with a number of reported errors. This potentially blocks PR's from being merged but can be tackled after the TES v1.1 milestone if there are no blocking errors.

Able to replicate by running the same command locally with the following command:

golangci-lint run --timeout 3m --verbose ./...
util/fsutil/io.go:21:21: Error return value of `d.SetReadDeadline` is not checked (errcheck)
                        d.SetReadDeadline(deadline)
                                         ^
util/fsutil/io.go:55:22: Error return value of `d.SetWriteDeadline` is not checked (errcheck)
                        d.SetWriteDeadline(deadline)
                                          ^
util/ring/ring_test.go:58:11: Error return value of `buf.Write` is not checked (errcheck)
        buf.Write([]byte("12345"))
                 ^
util/ring/ring_test.go:77:11: Error return value of `buf.Write` is not checked (errcheck)
        buf.Write([]byte("6789"))
                 ^
util/retry_test.go:23:9: Error return value of `r.Retry` is not checked (errcheck)
        r.Retry(bg, func() error {
               ^
util/retry_test.go:35:9: Error return value of `r.Retry` is not checked (errcheck)
        r.Retry(bg, func() error {
               ^
webdash/http.go:27:13: Error return value of `resp.Write` is not checked (errcheck)
                resp.Write(index)
                          ^
config/config_test.go:14:7: Error return value is not checked (errcheck)
        Parse([]byte(yaml), &conf)
             ^
config/gce/meta_test.go:43:10: Error return value of `w.Write` is not checked (errcheck)
                w.Write(loadTestData("metadata1"))
                       ^
tes/client_test.go:42:20: Error return value of `Marshaler.Marshal` is not checked (errcheck)
                Marshaler.Marshal(w, &ta)
                                 ^
tes/client_test.go:73:20: Error return value of `Marshaler.Marshal` is not checked (errcheck)
                Marshaler.Marshal(w, &ta)
                                 ^
tes/utils.go:110:15: Error return value of `deepcopy.Copy` is not checked (errcheck)
        deepcopy.Copy(view, task)
                     ^
cmd/task/task_test.go:23:13: Error return value of `cmd.Execute` is not checked (errcheck)
        cmd.Execute()
                   ^
cmd/task/task_test.go:38:13: Error return value of `cmd.Execute` is not checked (errcheck)
        cmd.Execute()
                   ^
cmd/task/task_test.go:52:13: Error return value of `cmd.Execute` is not checked (errcheck)
        cmd.Execute()
                   ^
logger/text_formatter_test.go:28:11: Error return value of `tf.Format` is not checked (errcheck)
        tf.Format(entry)
                 ^
cmd/run/flags.go:175:10: Error return value of `fl.Parse` is not checked (errcheck)
        fl.Parse(args)
                ^
cmd/run/flags.go:188:16: Error return value of `flags.ParseAll` is not checked (errcheck)
        flags.ParseAll(args, func(f *pflag.Flag, value string) error {
                      ^
cmd/run/task_group.go:62:25: Error return value of `tg.client.WaitForTask` is not checked (errcheck)
                        tg.client.WaitForTask(context.Background(), tid)
                                             ^
storage/ftp.go:138:17: Error return value of `b.client.Logout` is not checked (errcheck)
        b.client.Logout()
                       ^
storage/ftp.go:139:15: Error return value of `b.client.Quit` is not checked (errcheck)
        b.client.Quit()
                     ^
storage/local_test.go:40:18: Error return value of `ioutil.WriteFile` is not checked (errcheck)
        ioutil.WriteFile(ip, []byte("foo"), os.ModePerm)
                        ^
storage/local_test.go:166:18: Error return value of `ioutil.WriteFile` is not checked (errcheck)
        ioutil.WriteFile(ip, []byte("foo"), os.ModePerm)
                        ^
storage/local_test.go:194:18: Error return value of `ioutil.WriteFile` is not checked (errcheck)
        ioutil.WriteFile(cp, []byte("foo"), os.ModePerm)
                        ^
cmd/aws/batch/createall.go:47:20: Error return value of `config.ParseFile` is not checked (errcheck)
                        config.ParseFile(funnelConfigFile, &funnelConf)
                                        ^
cmd/aws/batch/createjobdef.go:41:20: Error return value of `config.ParseFile` is not checked (errcheck)
                        config.ParseFile(funnelConfigFile, &funnelConf)
                                        ^
events/executor.go:164:8: Error return value is not checked (errcheck)
                flush(stdoutbuf, Type_EXECUTOR_STDOUT)
                     ^
events/executor.go:165:8: Error return value is not checked (errcheck)
                flush(stdoutbuf, Type_EXECUTOR_STDERR)
                     ^
events/executor.go:235:18: Error return value of `out.WriteEvent` is not checked (errcheck)
                        out.WriteEvent(ctx, e)
                                      ^
events/executor.go:261:20: Error return value of `stdoutbuf.Write` is not checked (errcheck)
                                stdoutbuf.Write(b)
                                               ^
events/executor.go:266:20: Error return value of `stderrbuf.Write` is not checked (errcheck)
                                stderrbuf.Write(b)
                                               ^
events/kafka.go:85:16: Error return value of `w.WriteEvent` is not checked (errcheck)
                        w.WriteEvent(context.Background(), ev)
                                    ^
events/pubsub.go:100:13: Error return value of `sub.Receive` is not checked (errcheck)
        sub.Receive(ctx, func(ctx oldctx.Context, m *pubsub.Message) {
                   ^
events/pubsub.go:106:15: Error return value of `w.WriteEvent` is not checked (errcheck)
                w.WriteEvent(context.Background(), ev)
                            ^
compute/batch/backend.go:102:21: Error return value of `b.event.WriteEvent` is not checked (errcheck)
                b.event.WriteEvent(ctx, events.NewState(task.Id, tes.SystemError))
                                  ^
compute/batch/backend.go:103:21: Error return value of `b.event.WriteEvent` is not checked (errcheck)
                b.event.WriteEvent(
                                  ^
compute/batch/backend.go:216:26: Error return value of `b.event.WriteEvent` is not checked (errcheck)
                                                        b.event.WriteEvent(ctx, events.NewState(task.Id, tes.SystemError))
                                                                          ^
database/dynamodb/util.go:367:25: Error return value of `db.client.DeleteItem` is not checked (errcheck)
                                db.client.DeleteItem(item)
                                                    ^
worker/docker.go:36:19: Error return value of `dcmd.Event.Error` is not checked (errcheck)
                dcmd.Event.Error("failed to sync docker client API version", err)
                                ^
worker/docker.go:42:19: Error return value of `dcmd.Event.Error` is not checked (errcheck)
                dcmd.Event.Error("failed to pull docker image", err)
                                ^
worker/docker.go:74:17: Error return value of `dcmd.Event.Info` is not checked (errcheck)
        dcmd.Event.Info("Running command", "cmd", "docker "+strings.Join(args, " "))
                       ^
worker/docker.go:88:17: Error return value of `dcmd.Event.Info` is not checked (errcheck)
        dcmd.Event.Info("Command %s Complete exit=%s", strings.Join(args, " "), out)
                       ^
worker/docker.go:94:17: Error return value of `dcmd.Event.Info` is not checked (errcheck)
        dcmd.Event.Info("Stopping container", "container", dcmd.ContainerName)
                       ^
worker/step.go:20:19: Error return value of `s.Event.StartTime` is not checked (errcheck)
        s.Event.StartTime(time.Now())
                         ^
worker/step.go:58:18: Error return value of `s.Command.Stop` is not checked (errcheck)
                        s.Command.Stop()
                                      ^
worker/step.go:60:19: Error return value of `s.Event.EndTime` is not checked (errcheck)
                        s.Event.EndTime(time.Now())
                                       ^
worker/step.go:64:19: Error return value of `s.Event.EndTime` is not checked (errcheck)
                        s.Event.EndTime(time.Now())
                                       ^
worker/step.go:65:20: Error return value of `s.Event.ExitCode` is not checked (errcheck)
                        s.Event.ExitCode(getExitCode(result))
                                        ^
worker/storage.go:35:12: Error return value of `ev.Warn` is not checked (errcheck)
                                ev.Warn("download source directory is empty", "url", input.Url)
                                       ^
worker/storage.go:100:12: Error return value of `ev.Warn` is not checked (errcheck)
                                ev.Warn("upload source directory is empty", "url", output.Url)
                                       ^
cmd/run/parse_vars.go:222:6: func `containerPath` is unused (unused)
func containerPath(raw, base string) string {
     ^
events/retry.go:9:6: type `retrier` is unused (unused)
type retrier struct {
     ^
events/retry.go:14:19: func `(*retrier).WriteEvent` is unused (unused)
func (r *retrier) WriteEvent(ctx context.Context, e *Event) error {
                  ^
database/dynamodb/errors.go:8:5: var `errNotFound` is unused (unused)
var errNotFound = errors.New("not found")
    ^
database/dynamodb/util.go:317:21: func `(*DynamoDB).deleteTask` is unused (unused)
func (db *DynamoDB) deleteTask(ctx context.Context, id string) error {
                    ^
compute/util.go:9:6: func `detectFunnelBinaryPath` is unused (unused)
func detectFunnelBinaryPath() (string, error) {
     ^
tests/funnel_utils.go:410:18: func `(*Funnel).findTestServerContainers` is unused (unused)
func (f *Funnel) findTestServerContainers() []string {
                 ^
cmd/termdash/widgets/input.go:83:5: S1003: should use strings.Contains(inputChars, ch) instead (gosimple)
        if strings.Index(inputChars, ch) > -1 {
           ^
database/datastore/tes.go:50:46: S1019: should use make([]datastore.PropertyList, len(keys)) instead (gosimple)
        proplists := make([]datastore.PropertyList, len(keys), len(keys))
                                                    ^
database/datastore/tes.go:112:46: S1019: should use make([]datastore.PropertyList, len(keys)) instead (gosimple)
        proplists := make([]datastore.PropertyList, len(keys), len(keys))
                                                    ^
database/dynamodb/util.go:369:4: S1008: should use 'return page.LastEvaluatedKey != nil' instead of 'if page.LastEvaluatedKey == nil { return false }; return true' (gosimple)
                        if page.LastEvaluatedKey == nil {
                        ^
database/dynamodb/util.go:477:4: S1008: should use 'return page.LastEvaluatedKey != nil' instead of 'if page.LastEvaluatedKey == nil { return false }; return true' (gosimple)
                        if page.LastEvaluatedKey == nil {
                        ^
database/dynamodb/util.go:514:4: S1008: should use 'return page.LastEvaluatedKey != nil' instead of 'if page.LastEvaluatedKey == nil { return false }; return true' (gosimple)
                        if page.LastEvaluatedKey == nil {
                        ^
database/mongodb/events.go:37:4: S1008: should use 'return err == mgo.ErrNotFound' instead of 'if err == mgo.ErrNotFound { return true }; return false' (gosimple)
                        if err == mgo.ErrNotFound {
                        ^
cmd/termdash/compact/grid.go:64:2: S1011: should replace loop with `cg.Rows = append(cg.Rows, rows...)` (gosimple)
        for _, r := range rows {
        ^
cmd/termdash/config/main.go:12:2: S1011: should replace loop with `GlobalParams = append(GlobalParams, params...)` (gosimple)
        for _, p := range params {
        ^
cmd/termdash/config/main.go:15:2: S1011: should replace loop with `GlobalSwitches = append(GlobalSwitches, switches...)` (gosimple)
        for _, s := range switches {
        ^
cmd/termdash/tasksource.go:91:2: S1011: should replace loop with `tasks = append(tasks, ts.tasks...)` (gosimple)
        for _, t := range ts.tasks {
        ^
util/aws/session.go:22:9: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
                re := regexp.MustCompile("^s3.*\\.amazonaws\\.com/")
                      ^
events/systemlog.go:102:8: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
        re := regexp.MustCompile("[\\s]+")
              ^
storage/amazon_s3.go:283:9: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
                re := regexp.MustCompile("^s3.*\\.amazonaws\\.com/")
                      ^
cmd/termdash/config/switch.go:49:12: S1002: should omit comparison to bool constant, can be simplified to `!sw.Val` (gosimple)
        newVal := sw.Val != true
                  ^
tests/funnel_utils.go:407:2: S1023: redundant `return` statement (gosimple)
        return
        ^
tests/funnel_utils.go:434:2: S1023: redundant `return` statement (gosimple)
        return
        ^
tests/funnel_utils.go:441:2: S1023: redundant `return` statement (gosimple)
        return
        ^
compute/scheduler/testutils_test.go:87:4: testinggoroutine: call to (*T).Fatal from a non-test goroutine (govet)
                        t.Fatal("time limit expired")
                        ^
tests/core/basic_test.go:1137:5: testinggoroutine: call to (*T).Fatal from a non-test goroutine (govet)
                                t.Fatal(err)
                                ^
tests/core/basic_test.go:1151:5: testinggoroutine: call to (*T).Fatal from a non-test goroutine (govet)
                                t.Fatal(err)
                                ^
events/systemlog.go:71:2: ineffectual assignment to si (ineffassign)
        si := make(map[string]interface{})
        ^
database/boltdb/events.go:145:3: ineffectual assignment to err (ineffassign)
                err = taskBolt.db.Update(func(tx *bolt.Tx) error {
                ^
tests/funnel_utils.go:331:17: ineffectual assignment to err (ineffassign)
                funnelBinary, err = filepath.Abs("../../funnel")
                              ^
cmd/node/run.go:37:2: ineffectual assignment to runctx (ineffassign)
        runctx, cancel := context.WithCancel(context.Background())
        ^
worker/taskreader_test.go:15:8: ineffectual assignment to err (ineffassign)
        task, err := r.Task(ctx)
              ^
cmd/run/cmd.go:24:3: SA9003: empty branch (staticcheck)
                if err != nil {
                ^
storage/http.go:41:2: SA4017: WithContext doesn't have side effects and its return value is ignored (staticcheck)
        req.WithContext(ctx)
        ^
storage/http.go:74:2: SA4017: WithContext doesn't have side effects and its return value is ignored (staticcheck)
        req.WithContext(ctx)
        ^
tes/client.go:63:2: SA4017: WithContext doesn't have side effects and its return value is ignored (staticcheck)
        hreq.WithContext(ctx)
        ^
storage/storage_test.go:121:2: SA4006: this value of `url` is never used (staticcheck)
        url, err = b.parse("gs://1000genomes/README.analysis_history")
        ^
storage/storage_test.go:126:2: SA4006: this value of `url` is never used (staticcheck)
        url, err = b.parse("s3://")
        ^
storage/storage_test.go:182:2: SA4006: this value of `url` is never used (staticcheck)
        url, _, err = ab.parse("gs://1000genomes/README.analysis_history")
        ^
compute/scheduler/testutils_test.go:84:2: SA2002: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (staticcheck)
        go func() {
        ^
tests/core/basic_test.go:1133:3: SA2002: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (staticcheck)
                go func(id string) {
                ^
tests/core/basic_test.go:1147:3: SA2002: the goroutine calls T.Fatal, which must be called in the same goroutine as the test (staticcheck)
                go func(id string) {
                ^
events/json.go:6:2: SA1019: "github.com/golang/protobuf/jsonpb" is deprecated: Use the "google.golang.org/protobuf/encoding/protojson" package instead. (staticcheck)
        "github.com/golang/protobuf/jsonpb"
        ^
database/elastic/scheduler.go:57:15: SA1019: grpc.Errorf is deprecated: use status.Errorf instead. (staticcheck)
                return nil, grpc.Errorf(codes.NotFound, fmt.Sprintf("%v: nodeID: %s", err.Error(), req.Id))
                            ^
database/elastic/events.go:7:2: SA1019: "github.com/golang/protobuf/jsonpb" is deprecated: Use the "google.golang.org/protobuf/encoding/protojson" package instead. (staticcheck)
        "github.com/golang/protobuf/jsonpb"
database/elastic/scheduler.go:7:2: SA1019: "github.com/golang/protobuf/jsonpb" is deprecated: Use the "google.golang.org/protobuf/encoding/protojson" package instead. (staticcheck)
        "github.com/golang/protobuf/jsonpb"
        ^
database/mongodb/scheduler.go:69:15: SA1019: grpc.Errorf is deprecated: use status.Errorf instead. (staticcheck)
                return nil, grpc.Errorf(codes.NotFound, fmt.Sprintf("%v: nodeID: %s", mgo.ErrNotFound.Error(), req.Id))
                            ^
database/mongodb/scheduler.go:81:15: SA1019: grpc.Errorf is deprecated: use status.Errorf instead. (staticcheck)
                return nil, grpc.Errorf(codes.NotFound, fmt.Sprintf("%v: nodeID: %s", mgo.ErrNotFound.Error(), req.Id))
                            ^
database/badger/events.go:9:8: SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead. (staticcheck)
        proto "github.com/golang/protobuf/proto"
              ^
database/badger/tes.go:8:8: SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead. (staticcheck)
        proto "github.com/golang/protobuf/proto"
              ^
database/boltdb/events.go:9:8: SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead. (staticcheck)
        proto "github.com/golang/protobuf/proto"
              ^
util/dockerutil/docker.go:16:18: SA1019: client.NewEnvClient is deprecated: use NewClientWithOpts(FromEnv) (staticcheck)
        dclient, err := client.NewEnvClient()
                        ^
tests/funnel_utils.go:246:58: SA1019: grpc.FailFast is deprecated: use WaitForReady. (staticcheck)
        resp, cerr := f.RPC.CreateTask(context.Background(), t, grpc.FailFast(false))
                                                                ^
logger/text_formatter.go:75:16: SA1019: aurora.BrownFg is deprecated: use YellowFg instead, following specifications (staticcheck)
                levelColor = aurora.BrownFg
                             ^
logger/text_formatter.go:19:2: SA1019: "golang.org/x/crypto/ssh/terminal" is deprecated: this package moved to golang.org/x/term. (staticcheck)
        "golang.org/x/crypto/ssh/terminal"
        ^
storage/google_cloud.go:55:15: SA1019: storage.New is deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. (staticcheck)
        svc, cerr := storage.New(client)
                     ^
storage/anonymous_get_test.go:50:14: SA1019: storage.New is deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. (staticcheck)
        svc, err := storage.New(&http.Client{})
                    ^
tests/core/validation_test.go:23:7: SA1019: grpc.ErrorDesc is deprecated: use status.Convert and Message method instead. (staticcheck)
        e := grpc.ErrorDesc(err)
             ^
tests/core/validation_test.go:43:7: SA1019: grpc.ErrorDesc is deprecated: use status.Convert and Message method instead. (staticcheck)
        e := grpc.ErrorDesc(err)
             ^
tests/core/validation_test.go:101:7: SA1019: grpc.ErrorDesc is deprecated: use status.Convert and Message method instead. (staticcheck)
        e := grpc.ErrorDesc(err)
             ^
tests/storage/gs_test.go:230:17: SA1019: gs.New is deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. (staticcheck)
        client, err := gs.New(defClient)
                       ^
compute/scheduler/node_util.go:70:5: SA4003: no value of type uint32 is less than 0 (staticcheck)
        if out.Cpus < 0 {
           ^
cmd/task/create.go:25:3: SA5001: should check returned error before deferring f.Close() (staticcheck)
                defer f.Close()
                ^
INFO File cache stats: 62 entries of total size 232.8KiB
INFO Memory: 108 samples, avg is 594.1MB, max is 1498.7MB
INFO Execution took 10.668475917s

Github Actions job defined in .github/workflows/tests.yaml

  lint:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-go@v3
        with:
          go-version: 1.18
      - uses: actions/checkout@v3
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v3
        with:
          version: v1.52.2
          args: --timeout 3m --verbose
@lbeckman314 lbeckman314 self-assigned this May 15, 2023
@lbeckman314 lbeckman314 linked a pull request Jun 20, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant