Golang中的最终期限(time.Now())是什么?

I saw a lot d.deadline(time.Now()) in net package. From the name, I just guess it just set deadline on now, which has no meaning in network communication. So what is the purpose deadline(time.Now()) in golang?

This is the function you are referring to (net package, file dial.go). So, it returns the first deadline to come between the deadline set and the timeout set for the connection.

67  // Return either now+Timeout or Deadline, whichever comes first.
68  // Or zero, if neither is set.
69  func (d *Dialer) deadline(now time.Time) time.Time {
70      if d.Timeout == 0 {
71          return d.Deadline
72      }
73      timeoutDeadline := now.Add(d.Timeout)
74      if d.Deadline.IsZero() || timeoutDeadline.Before(d.Deadline) {
75          return timeoutDeadline
76      } else {
77          return d.Deadline
78      }
79  }