Go: net: remove dependency on fmt, unicode via golang.org/x/net/dns/dnsmessage

Created on 6 Jul 2020  路  4Comments  路  Source: golang/go

net should not depend on fmt and unicode.

golang.org/x/net/dns/dnsmessage contains one line using fmt:

return nil, off, fmt.Errorf("invalid resource type: %d", hdr.Type)

But dnsmessage is vendored into the standard library and imported by net,
and this use is making net depend on fmt, and in turn on unicode.

This one line should be changed, to remove the use of fmt.

go/build.TestDependencies claims to check that net does not
depend on unicode, which should have detected this, but that
test does not look inside vendored packages.

I have a fix that I will send out for that problem as well.

NeedsFix release-blocker

Most helpful comment

Is there anything else to do here? As far as I can tell this issue can be closed.

All 4 comments

Change https://golang.org/cl/241078 mentions this issue: go/build: rewrite TestDependencies to be cleaner, more correct

Change https://golang.org/cl/241085 mentions this issue: dns/dnsmessage: remove use of fmt that crept in

Is there anything else to do here? As far as I can tell this issue can be closed.

I've confirmed the package net does not import fmt nor unicode, not even indirectly. It was resolved via CL 241257, and CL 241078 added a regression test (see this line).

Closing as this issue is fixed. Please comment if I missed something.

Was this page helpful?
0 / 5 - 0 ratings