goban icon indicating copy to clipboard operation
goban copied to clipboard

No results and/or output

Open RoarkeRandall opened this issue 4 years ago • 6 comments

Hello,

I'm trying to use this tool, i think it will be very useful for our team. I tried using the example configuration files and I get no output for using context.TODO() . I use context.TODO in the repo. I am able to get it to output that url.Values() was used though.

Roarke

RoarkeRandall avatar Feb 11 '21 02:02 RoarkeRandall

Hi RoarkeRandall,

Thanks for reaching out! I'm happy that you've found it useful :) Can you please share your goban.cfg and how you run goban?

I've tried testing it right now and it seems to work for me.

main.go

package main

import "context"

func main() {
	ctx := context.TODO()

	println(ctx)
}

goban.cfg

context.TODO

goban -cfg goban.cfg .

/home/u/tmp/goban-test/main.go:6:9: func context.TODO is banned

utrack avatar Feb 11 '21 09:02 utrack

Aha, I think I've got it. It works for rule context.TODO, but not for context.TODO(). I'll get on it right away.

utrack avatar Feb 11 '21 09:02 utrack

Now rule context.TODO() works as well as context.TODO.

utrack avatar Feb 11 '21 11:02 utrack

Hey, thanks for looking into this so quickly!

i haven't tried your latest update, but I tried a few different configs just now (on version 1.1.0):

# bans `context.TODO()`
context.TODO

# bans first-party imports of `foo/bar`
foo/bar

this works, context.TODO is found

# bans `context.TODO()`
context.TODO

This does not work, no lint errors are reported

RoarkeRandall avatar Feb 11 '21 14:02 RoarkeRandall

I just confirmed the same behavior with the latest code (1.1.1)

RoarkeRandall avatar Feb 11 '21 14:02 RoarkeRandall

Hmm, I've tried to reproduce it but it didn't work. Could you please do hexdump goban.cfg and send the result back to me? Maybe there are some non-printable characters in your config file.

» hexdump goban.cfg                                                                                                                                                                                                        2021-02-15 10:01:47
0000000 2023 6162 736e 6020 6f63 746e 7865 2e74
0000010 4f54 4f44 2928 0a60 6f63 746e 7865 2e74
0000020 4f54 4f44 000a
0000025


~/tmp/goban-test
» cat main.go                                                                                                                                                                                                              2021-02-15 10:02:20
package main

import (
        "context"
        "net/http"
)

func main() {
        ctx := context.TODO()

        println(ctx)
        http.DefaultClient = &http.Client{}
}


~/tmp/goban-test
» cat goban.cfg                                                                                                                                                                                                            2021-02-15 10:03:07
# bans `context.TODO()`
context.TODO


~/tmp/goban-test
» goban -cfg goban.cfg .                                                                                                                                                                                                   2021-02-15 10:03:11
/home/u/tmp/goban-test/main.go:9:9: func context.TODO is banned -

utrack avatar Feb 15 '21 07:02 utrack