Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1227

Goland throw warnings from client.Ping method

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.0.4
    • Component/s: Connections
    • Labels:
      None
    • Environment:

      I'm using JetBrains Goland IDE with next simple code to connection ping

      // code placeholder
      ctx, cancel := context.WithTimeout(context.Background(), appConfig.DB.Timeout*time.Second)
      client, err := mongo.Connect(ctx, options.Client().ApplyURI(appConfig.DB.URI))
      defer cancel()
      //Call the connect function of client
      //noinspection GoNilness
      err = client.Ping(ctx, readpref.Primary())
      if err != nil {
         logrus.WithField("mongo", appConfig.DB.URI).Fatal("Mongo connection failed after timeout")
      } else {
         logrus.WithField("mongo", appConfig.DB.URI).Info("Mongo connected")
         appConfig.DB.Client = client
      }
      

      method err = client.Ping(ctx, readpref.Primary()) show an error with message:

      Can I fix myself in my code or it's deeper?

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            ivan.skiridomov@gmail.com Ivan Skiridomov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: