aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vet/testdata
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2023-05-16 13:47:46 -0400
committerJonathan Amsterdam <jba@google.com>2023-05-22 18:11:19 +0000
commit6d4d71c5abe104d95ede3aa2f3eaaef7bc613ebb (patch)
treeea9311746e2420678a1af7a763dfc724c044b0c6 /src/cmd/vet/testdata
parent1cfacfbe8ae7ed12eb798c84b53e1ebd0e3ed0b0 (diff)
downloadgo-6d4d71c5abe104d95ede3aa2f3eaaef7bc613ebb.tar.xz
cmd/vet: add slog checker
Add the slog static analysis pass to `go vet`. Vendor in golang.org/x/tools@master to pick up the pass. Tweak a test in slog to avoid triggering the vet check. Change-Id: I55ceac9a4e6876c8385897784542761ea0af2481 Reviewed-on: https://go-review.googlesource.com/c/go/+/496156 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/vet/testdata')
-rw-r--r--src/cmd/vet/testdata/slog/slog.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cmd/vet/testdata/slog/slog.go b/src/cmd/vet/testdata/slog/slog.go
new file mode 100644
index 0000000000..accb04361b
--- /dev/null
+++ b/src/cmd/vet/testdata/slog/slog.go
@@ -0,0 +1,13 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file contains tests for the slog checker.
+
+package slog
+
+import "log/slog"
+
+func SlogTest() {
+ slog.Info("msg", "a") // ERROR "call to slog.Info missing a final value"
+}