Been trying to use gonnel for some tunnels. Tried to open 2 tunnels, and then when they got closed, I noticed that the log package is saying that is trying to close the same tunnel twice. From looking at the code, it seems that (one of) the problems is this:

I thought I would take advantage of staticcheck, golangci-lint or even go vet to have it highlight this problem, so that I can be more confident on a fix. However, when I run the tools, I get this output:
go vet:
staticcheck:
Also tried running go vet with -loopclosure, but I still don't get any output. Shouldn't one of the tools say that the go func needs the iterator variable passed as param? If it helps, I'm running go 1.14.3 darwin/amd64, and also tried importing the code in goland, but I didn't get an inspection warning for that piece of code. I am getting a feeling that I might be doing something wrong, could you spot what it is?
Thanks!



c.Tunnelcontains duplicates. I noticed thatAddTunneldoesn't check for duplicate insertions. If there are duplicates, there could be a race ont.IsCreated. SinceCloseTunnelandDisconnectAlldon't uset.IsCreatedin a thread-safe way, it's possible that two of the closure goroutines can be spawned for the same tunnel if it's inc.Tunneltwice.go 1.14.3,staticcheck 2020.1.4, andgolangci-lint has version 1.27.0 built from fb74c2e on 2020-05-13T18:45:55ZShouldn't one of the tools say that the go func needs the iterator variable passed as param?this is opinion based and you should talk about that with the lib authors.