Disable false positive go vet check in tests per line?

84 views
Skip to first unread message

Steven Hartland

unread,
Jan 28, 2024, 3:13:48 PM1/28/24
to golang-nuts
When running a test I'm getting:
missing ... in args forwarded to print-like function

Usually this would be helpful as the pass in variadic should generally be expanded with ... but in this case I specifically want the result of args passed as a slice.

Is there a way to disable go vet checks for tests on a line by line basis like what would do with golangci-lint //nocheck: ?

  Regards
  Steve

Kurtis Rader

unread,
Jan 28, 2024, 4:24:49 PM1/28/24
to Steven Hartland, golang-nuts
What happens if you just alias the var?

argsCopy := args
fmt.Printf("%v\n", argsCopy)


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA38peaR%3DhFQPv3cCcDndfsEkqkM-X5s8rC1H%2BeOzAJ3ijhqPQ%40mail.gmail.com.


--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Steven Hartland

unread,
Jan 28, 2024, 5:26:27 PM1/28/24
to Kurtis Rader, golang-nuts
Thanks Kurtis, that's a good workaround :)
Reply all
Reply to author
Forward
0 new messages