Skip to content

docs: name NewDialer correctly in the doc comments - #19

Merged
chrj merged 1 commit into
mainfrom
chrj/fix-newdialer-doc-references
Aug 23, 2026
Merged

docs: name NewDialer correctly in the doc comments#19
chrj merged 1 commit into
mainfrom
chrj/fix-newdialer-doc-references

Conversation

@chrj

@chrj chrj commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Four comments in ssrf.go call the constructor New. The exported function is NewDialer, and no symbol named New exists in this package:

$ go doc github.com/chrj/ssrf.New
doc: no symbol New in package github.com/chrj/ssrf

A reader who follows the deprecation message reaches a function that is not there. This came up while moving chrj/tools off the deprecated ssrf.DialContext.

The four places

Location Was Now
Dialer doc example d := ssrf.New(...) d := ssrf.NewDialer(...)
NewDialer doc comment "New creates a new Dialer" "NewDialer creates a new Dialer"
DialContext doc comment "convenience wrapper around New" "convenience wrapper around NewDialer"
DialContext deprecation notice "Deprecated: Use New" "Deprecated: Use NewDialer"

The third row is the one a caller actually meets: it is the text an editor shows when it marks the deprecated call.

The second row also fixes a doc convention. A comment on an exported function starts with the name of that function, and this one started with New while the function is NewDialer.

Scope

Comments only. No code changes, so no behavior changes.

The README already uses NewDialer in all 13 places, so it needs no change.

go build, go test, and golangci-lint run ./... all pass.

Four comments in ssrf.go call the constructor New. The exported function
is NewDialer, and no symbol named New exists in this package. A reader
who follows the deprecation message reaches a function that is not
there.

  the Dialer example      ssrf.New(...)        -> ssrf.NewDialer(...)
  the NewDialer comment   "New creates ..."    -> "NewDialer creates ..."
  the DialContext comment "wrapper around New" -> "wrapper around NewDialer"
  the deprecation notice  "Use New"            -> "Use NewDialer"

The comment on NewDialer now starts with the name of the function, as go
doc expects.

The README already uses NewDialer everywhere, so it needs no change.
@chrj
chrj marked this pull request as ready for review August 23, 2026 10:49
@chrj
chrj merged commit bc8fc5f into main Aug 23, 2026
2 checks passed
@chrj
chrj deleted the chrj/fix-newdialer-doc-references branch August 23, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant