Thanks so much Matt, appreciate your wisdom. On Wednesday, February 3, 2021 at 11:45:50 AM UTC-5 matthew...@nytimes.com wrote:
> You are correct sir, and unfortunately, go vet doesn't find it either. > But if you lint your code with golangci-lint ( > https://github.com/golangci/golangci-lint) > the deadcode linter will find it for you. > > On Wed, Feb 3, 2021 at 9:35 AM Danny Hart <iamdan...@gmail.com> wrote: > >> Hello all, >> >> Very new gopher here (also first time using Groups, please excuse poor >> etiquette). I was curious why the following basic program compiles with an >> unused var. Is it the case that the compiler only complains about unused >> vars in a function body? >> >> package main >> >> import ( >> "fmt" >> ) >> >> var ( >> x int >> ) >> >> func main() { >> fmt.Println("Hello, playground") >> } >> >> -- >> 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/d4e80994-8f42-4fe9-888f-26dd973ccbc3n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/d4e80994-8f42-4fe9-888f-26dd973ccbc3n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > *Matt Holiday* > Senior Gopher, Marketing Technologies > > 620 Eighth Avenue > > New York, NY 10018 > > matthew...@nytimes.com > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/08e0ab59-c7ea-46a5-8733-9870393d2fe5n%40googlegroups.com.