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

Harness for 7 chokes on the "gotcha" #18

Closed
ribasushi opened this issue Jun 22, 2018 · 2 comments
Closed

Harness for 7 chokes on the "gotcha" #18

ribasushi opened this issue Jun 22, 2018 · 2 comments

Comments

@ribasushi
Copy link

Related to #16, if I omit the pass-by-reference:

func ( u User ) SetUsername ( uname string ) {      // <--- * missing here
  u.username = username(uname)
}

Then the error is yet again

$ go test
--- FAIL: TestMethods (0.00s)
panic: interface conversion: interface {} is user.username, not string [recovered]
        panic: interface conversion: interface {} is user.username, not string

goroutine 5 [running]:
testing.tRunner.func1(0xc4201240f0)
        /usr/lib/go-1.10/src/testing/testing.go:742 +0x29d
panic(0x687ce0, 0xc420062880)
        /usr/lib/go-1.10/src/runtime/panic.go:502 +0x229
github.com/stretchr/testify/assert.diff(0x66f4c0, 0x70bd60, 0x66f4c0, 0xc420010c80, 0x0, 0x0)
        /home/goclass/go/src/github.com/stretchr/testify/assert/assertions.go:1352 +0x453
github.com/stretchr/testify/assert.Equal(0x70d260, 0xc4201240f0, 0x66f4c0, 0x70bd60, 0x66f4c0, 0xc420010c80, 0xc420059e48, 0x1, 0x1, 0xc420010c80)
        /home/goclass/go/src/github.com/stretchr/testify/assert/assertions.go:338 +0x26a
github.com/stretchr/testify/assert.(*Assertions).Equal(0xc420047dc8, 0x66f4c0, 0x70bd60, 0x66f4c0, 0xc420010c80, 0xc420047e48, 0x1, 0x1, 0x40d9f301)
        /home/goclass/go/src/github.com/stretchr/testify/assert/assertion_forward.go:129 +0xca
github.com/autarch/intro-to-go-class-exercises/7-basic-oo/user.TestMethods(0xc4201240f0)
        /home/goclass/go/src/github.com/autarch/intro-to-go-class-exercises/7-basic-oo/user/user_test.go:21 +0x48a
testing.tRunner(0xc4201240f0, 0x6ec5e0)
        /usr/lib/go-1.10/src/testing/testing.go:777 +0xd0
created by testing.(*T).Run
        /usr/lib/go-1.10/src/testing/testing.go:824 +0x2e0
exit status 2
FAIL    github.com/autarch/intro-to-go-class-exercises/7-basic-oo/user  0.008s
@autarch
Copy link
Owner

autarch commented Jun 25, 2018

Fixed in stretchr/testify#622

Hopefully this will get merged before the next time I do this class.

@autarch
Copy link
Owner

autarch commented Jan 4, 2019

Fixed by updating the deps for the class exercises.

@autarch autarch closed this as completed Jan 4, 2019
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

2 participants