[go] net: document LookupSRV cname return value

8 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Feb 6, 2026, 3:19:00 AMFeb 6
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

net: document LookupSRV cname return value

Document that the first return value of LookupSRV is the canonical
name of the DNS target that was looked up, which may differ from
the input name due to CNAME records.

Fixes #49982
Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
GitHub-Last-Rev: a8dd7287f807513f6d03e4f5c0b5ac1ccb1b6053
GitHub-Pull-Request: golang/go#77475

Change diff

diff --git a/src/net/lookup.go b/src/net/lookup.go
index d4be8ea..5ab4153 100644
--- a/src/net/lookup.go
+++ b/src/net/lookup.go
@@ -487,6 +487,9 @@
// publishing SRV records under non-standard names, if both service
// and proto are empty strings, LookupSRV looks up name directly.
//
+// The returned cname is the canonical name of the DNS target that was
+// looked up, which may differ from the input name due to CNAME records.
+//
// The returned service names are validated to be properly
// formatted presentation-format domain names. If the response contains
// invalid names, those records are filtered out and an error
@@ -505,6 +508,9 @@
// publishing SRV records under non-standard names, if both service
// and proto are empty strings, LookupSRV looks up name directly.
//
+// The returned cname is the canonical name of the DNS target that was
+// looked up, which may differ from the input name due to CNAME records.
+//
// The returned service names are validated to be properly
// formatted presentation-format domain names. If the response contains
// invalid names, those records are filtered out and an error

Change information

Files:
  • M src/net/lookup.go
Change size: XS
Delta: 1 file changed, 6 insertions(+), 0 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
Gerrit-Change-Number: 742660
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
Feb 6, 2026, 3:23:01 AMFeb 6
to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Message from Gopher Robot

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
A maintainer will review your change and provide feedback. See
https://go.dev/doc/contribute#review for more info and tips to get your
patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11 or adds a tag like "wait-release", it means that this CL will be
reviewed as part of the next development cycle. See https://go.dev/s/release
for more details.

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
Gerrit-Change-Number: 742660
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Comment-Date: Fri, 06 Feb 2026 08:22:55 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Damien Neil (Gerrit)

unread,
Feb 6, 2026, 6:18:18 PMFeb 6
to Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Ian Lance Taylor

Damien Neil voted and added 1 comment

Votes added by Damien Neil

Hold+1

1 comment

File src/net/lookup.go
Line 491, Patchset 1 (Latest):// looked up, which may differ from the input name due to CNAME records.
Damien Neil . unresolved

I don't understand "...which may differ from the input name due to CNAME records". CNAME records don't seem to have anything to do with this name; so far as I can tell the first return parameter is entirely determined from the service, proto, and name parameters.

Open in Gerrit

Related details

Attention is currently required from:
  • Ian Lance Taylor
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Holds
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
    Gerrit-Change-Number: 742660
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Comment-Date: Fri, 06 Feb 2026 23:18:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    open
    diffy

    Yongqi Jia (Gerrit)

    unread,
    Feb 8, 2026, 9:22:35 PMFeb 8
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Yongqi Jia has uploaded the change for review

    Commit message

    net: document LookupSRV cname return value

    Document that the first return value (cname) of LookupSRV and
    Resolver.LookupSRV is the owner name from the first SRV answer
    record, which is typically the constructed DNS name
    (_service._proto.name) but may differ if CNAME records redirect
    the query to another name.

    Fixes #49982
    Change-Id: Ibfa2a5f07bf5991eac77f882a751447f5dd6bc4e

    Change diff

    diff --git a/src/net/lookup.go b/src/net/lookup.go
    index d4be8ea..06e14df 100644
    --- a/src/net/lookup.go
    +++ b/src/net/lookup.go
    @@ -487,6 +487,11 @@

    // publishing SRV records under non-standard names, if both service
    // and proto are empty strings, LookupSRV looks up name directly.
    //
    +// The returned cname is the owner name from the first SRV answer
    +// record, which is typically the constructed DNS name
    +// (_service._proto.name) but may differ if CNAME records redirect
    +// the query to another name.

    +//
    // The returned service names are validated to be properly
    // formatted presentation-format domain names. If the response contains
    // invalid names, those records are filtered out and an error
    @@ -505,6 +510,11 @@

    // publishing SRV records under non-standard names, if both service
    // and proto are empty strings, LookupSRV looks up name directly.
    //
    +// The returned cname is the owner name from the first SRV answer
    +// record, which is typically the constructed DNS name
    +// (_service._proto.name) but may differ if CNAME records redirect
    +// the query to another name.

    +//
    // The returned service names are validated to be properly
    // formatted presentation-format domain names. If the response contains
    // invalid names, those records are filtered out and an error

    Change information

    Files:
    • M src/net/lookup.go
    Change size: S
    Delta: 1 file changed, 10 insertions(+), 0 deletions(-)
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newchange
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ibfa2a5f07bf5991eac77f882a751447f5dd6bc4e
      Gerrit-Change-Number: 743161
      Gerrit-PatchSet: 1
      Gerrit-Owner: Yongqi Jia <yongqi...@gmail.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Yongqi Jia (Gerrit)

      unread,
      Feb 8, 2026, 9:24:27 PMFeb 8
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

      Yongqi Jia abandoned this change.

      View Change

      Abandoned Accidentally created duplicate CL. The correct CL is 742660.

      Yongqi Jia abandoned this change

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: abandon
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Yongqi Jia (Gerrit)

      unread,
      Feb 8, 2026, 9:32:51 PMFeb 8
      to Gerrit Bot, goph...@pubsubhelper.golang.org, Damien Neil, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Damien Neil and Ian Lance Taylor

      Yongqi Jia added 1 comment

      File src/net/lookup.go
      Line 491, Patchset 1 (Latest):// looked up, which may differ from the input name due to CNAME records.
      Damien Neil . resolved

      I don't understand "...which may differ from the input name due to CNAME records". CNAME records don't seem to have anything to do with this name; so far as I can tell the first return parameter is entirely determined from the service, proto, and name parameters.

      Yongqi Jia

      Done.

      You're right — the original wording was misleading. The cname return value isn't a CNAME record; it's the owner name from the first SRV answer record in the DNS response (see goLookupSRV in lookup.go around line 749, where cname = h.Name).

      I've updated the documentation in PS2 to:

      ```


      // The returned cname is the owner name from the first SRV answer

      // record, which is typically the constructed DNS name
      // (_service._proto.name) but may differ if CNAME records redirect
      // the query to another name.
      ```
      This makes clear that: (1) it comes from the DNS response header, not from CNAME records themselves; (2) it's typically identical to the constructed query name; (3) CNAME redirection is mentioned only as one possible reason for divergence, not as the definition.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Damien Neil
      • Ian Lance Taylor
      Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Holds
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
        Gerrit-Change-Number: 742660
        Gerrit-PatchSet: 1
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Damien Neil <dn...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Yongqi Jia <yongqi...@gmail.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Damien Neil <dn...@google.com>
        Gerrit-Comment-Date: Mon, 09 Feb 2026 02:32:42 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Damien Neil <dn...@google.com>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Gerrit Bot (Gerrit)

        unread,
        Feb 8, 2026, 9:44:03 PMFeb 8
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Damien Neil and Ian Lance Taylor

        Gerrit Bot uploaded new patchset

        Gerrit Bot uploaded patch set #2 to this change.
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Damien Neil
        • Ian Lance Taylor
        Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Holds
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
        Gerrit-Change-Number: 742660
        Gerrit-PatchSet: 2
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Damien Neil (Gerrit)

        unread,
        Feb 23, 2026, 5:56:07 PMFeb 23
        to Gerrit Bot, goph...@pubsubhelper.golang.org, Yongqi Jia, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Ian Lance Taylor

        Damien Neil voted and added 1 comment

        Votes added by Damien Neil

        Code-Review+2
        Commit-Queue+1
        Hold+1

        1 comment

        Patchset-level comments
        File-level comment, Patchset 2 (Latest):
        Damien Neil . resolved

        Thanks

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ian Lance Taylor
        Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Holds
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
        Gerrit-Change-Number: 742660
        Gerrit-PatchSet: 2
        Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Damien Neil <dn...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Yongqi Jia <yongqi...@gmail.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Comment-Date: Mon, 23 Feb 2026 22:56:04 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Nicholas Husin (Gerrit)

        unread,
        Apr 8, 2026, 3:19:02 AM (21 hours ago) Apr 8
        to Gerrit Bot, goph...@pubsubhelper.golang.org, Go LUCI, Damien Neil, Yongqi Jia, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Ian Lance Taylor

        Nicholas Husin voted Code-Review+1

        Code-Review+1
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ian Lance Taylor
        Submit Requirements:
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Holds
          • requirement satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          • requirement satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
          Gerrit-Change-Number: 742660
          Gerrit-PatchSet: 2
          Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
          Gerrit-Reviewer: Damien Neil <dn...@google.com>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Nicholas Husin <n...@golang.org>
          Gerrit-CC: Gopher Robot <go...@golang.org>
          Gerrit-CC: Yongqi Jia <yongqi...@gmail.com>
          Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Comment-Date: Wed, 08 Apr 2026 07:18:57 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Nicholas Husin (Gerrit)

          unread,
          Apr 8, 2026, 3:19:07 AM (21 hours ago) Apr 8
          to Gerrit Bot, goph...@pubsubhelper.golang.org, Nicholas Husin, Go LUCI, Damien Neil, Yongqi Jia, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
          Attention needed from Ian Lance Taylor

          Nicholas Husin voted Code-Review+1

          Code-Review+1
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Ian Lance Taylor
          Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Holds
            • requirement satisfiedNo-Unresolved-Comments
            • requirement satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
            Gerrit-Change-Number: 742660
            Gerrit-PatchSet: 2
            Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
            Gerrit-Reviewer: Damien Neil <dn...@google.com>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Nicholas Husin <hu...@google.com>
            Gerrit-Reviewer: Nicholas Husin <n...@golang.org>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-CC: Yongqi Jia <yongqi...@gmail.com>
            Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Comment-Date: Wed, 08 Apr 2026 07:19:04 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Damien Neil (Gerrit)

            unread,
            Apr 8, 2026, 3:20:53 PM (9 hours ago) Apr 8
            to Gerrit Bot, goph...@pubsubhelper.golang.org, Nicholas Husin, Nicholas Husin, Go LUCI, Yongqi Jia, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Ian Lance Taylor

            Damien Neil removed a vote from this change

            Removed Hold+1 by Damien Neil <dn...@google.com>
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Ian Lance Taylor
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: deleteVote
            satisfied_requirement
            open
            diffy

            Nicholas Husin (Gerrit)

            unread,
            Apr 8, 2026, 3:25:12 PM (9 hours ago) Apr 8
            to Gerrit Bot, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Nicholas Husin, Go LUCI, Damien Neil, Yongqi Jia, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com

            Nicholas Husin submitted the change

            Change information

            Commit message:
            net: document LookupSRV cname return value

            Document that the first return value of LookupSRV is the canonical
            name of the DNS target that was looked up, which may differ from

            the input name due to CNAME records.

            Fixes #49982
            Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
            GitHub-Last-Rev: 9c756d48d55587f373c7cf273aa64c960a7a94a8
            GitHub-Pull-Request: golang/go#77475
            Reviewed-by: Nicholas Husin <hu...@google.com>
            Reviewed-by: Nicholas Husin <n...@golang.org>
            Reviewed-by: Damien Neil <dn...@google.com>
            Files:
            • M src/net/lookup.go
            Change size: S
            Delta: 1 file changed, 10 insertions(+), 0 deletions(-)
            Branch: refs/heads/master
            Submit Requirements:
            • requirement satisfiedCode-Review: +2 by Damien Neil, +1 by Nicholas Husin
            • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
            Open in Gerrit
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: merged
            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d
            Gerrit-Change-Number: 742660
            Gerrit-PatchSet: 3
            open
            diffy
            satisfied_requirement
            Reply all
            Reply to author
            Forward
            0 new messages