Skip to content

Commit 702f164

Browse files
adonovangopherbot
authored andcommitted
cmd/vet: add hostport analyzer
+ test, release note Fixes #28308 Change-Id: I190e2fe513eeb6b90b0398841f67bf52510b5f59 Reviewed-on: https://go-review.googlesource.com/c/go/+/667596 Auto-Submit: Alan Donovan <[email protected]> Commit-Queue: Alan Donovan <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent fca5832 commit 702f164

File tree

10 files changed

+478
-3
lines changed

10 files changed

+478
-3
lines changed

doc/next/3-tools.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,17 @@ specifying the command's current version.
2626

2727
### Vet {#vet}
2828

29+
The `go vet` command includes new analyzers:
30+
2931
<!-- go.dev/issue/18022 -->
3032

31-
The `go vet` command now includes the
32-
[waitgroup](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/waitgroup)
33-
analyzer, which reports misplaced calls to [sync.WaitGroup.Add].
33+
- [waitgroup](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/waitgroup),
34+
which reports misplaced calls to [sync.WaitGroup.Add]; and
35+
36+
<!-- go.dev/issue/28308 -->
3437

38+
- [hostport](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/hostport),
39+
which reports uses of `fmt.Sprintf("%s:%d", host, port)` to
40+
construct addresses for [net.Dial], as these will not work with
41+
IPv6; instead it suggests using [net.JoinHostPort].
3542

src/cmd/go/internal/test/flagdefs.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/go/internal/test/flagdefs_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ func TestMain(m *testing.M) {
1818
os.Exit(m.Run())
1919
}
2020

21+
// TestPassFlagToTest ensures that the generated table of flags is
22+
// consistent with output of "go tool vet -flags", using the installed
23+
// go command---so if it fails, you may need to re-run make.bash.
2124
func TestPassFlagToTest(t *testing.T) {
2225
wantNames := genflags.ShortTestFlags()
2326

src/cmd/vendor/golang.org/x/tools/go/analysis/passes/hostport/hostport.go

+185
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/typeindex/typeindex.go

+33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)