Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests Panic on Windows #68

Open
cambefus opened this issue Nov 20, 2019 · 2 comments
Open

Tests Panic on Windows #68

cambefus opened this issue Nov 20, 2019 · 2 comments

Comments

@cambefus
Copy link

This is likely a Newbie issue (aka Id10t). I have just brought down the library (go get) to my windows 10 computer. Attempting to run tests on the code results in the following...

MINGW64 ~/go/src/github.com/cavaliercoder/grab (master)
$ go test .
--- FAIL: TestFilenameResolution (0.25s)
    --- FAIL: TestFilenameResolution/Using_Content-Disposition_Header_with_target_directory (0.05s)
        client_test.go:70: Filename mismatch. Expected '.test/header-filename', got '.test\header-filename'.
    --- FAIL: TestFilenameResolution/Using_URL_Path_with_target_directory (0.05s)
        client_test.go:70: Filename mismatch. Expected '.test/url-filename', got '.test\url-filename'.
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x10 pc=0x6bff14]

goroutine 1592 [running]:
testing.tRunner.func1(0xc00037a900)
        C:/Go/src/testing/testing.go:874 +0x3aa
panic(0x71f480, 0xa05920)
        C:/Go/src/runtime/panic.go:679 +0x1c0
github.com/cavaliercoder/grab.guessFilename(0xc000471ed0, 0xc00000a0f8, 0x787a34, 0x3, 0x78fc61)
        C:/Users/camer/go/src/github.com/cavaliercoder/grab/util.go:51 +0x34
github.com/cavaliercoder/grab.TestURLFilenames.func2(0xc00037a900)
        C:/Users/camer/go/src/github.com/cavaliercoder/grab/util_test.go:54 +0x12a
testing.tRunner(0xc00037a900, 0x7a3bb8)
        C:/Go/src/testing/testing.go:909 +0xd0
created by testing.(*T).Run
        C:/Go/src/testing/testing.go:960 +0x357
FAIL    github.com/cavaliercoder/grab   3.666s
FAIL
 ---

I am not fussed about the filename fails, but the panic has me blocked. I get the same error when attempting to use the library in my own code. Any suggestions are appreciated.

@cavaliercoder
Copy link
Collaborator

Not a noob question at all. Looks like a legit bug. Firstly I can see that director separators are a problem on windows so we’ll need to fix that. The nil deref panic is not obvious to me right now, so I’ll take a look when I get home and try get you unblocked. Thanks for reporting!

@oliverpool
Copy link
Contributor

@cavaliercoder I think the panic is not related to windows, but to a "recent" version of go (#72 probably fixes the panic).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants