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

Readme code samples print the address instead of a value #33

Open
coud opened this issue Aug 27, 2021 · 3 comments
Open

Readme code samples print the address instead of a value #33

coud opened this issue Aug 27, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@coud
Copy link

coud commented Aug 27, 2021

As title says. For example this code:

import (
    "fmt"
    "gorm.io/gorm"
    "github.com/Thor-x86/nullable"
)

func main() {
    // Create new
    myBasicString := "Hello blяoW!"
    myNullableString := nullable.NewString(&myBasicString)

    // Get and print to command console
    fmt.Println(myNullableString.Get()) // Output: Hello blяoW!
}

The code will not output the string content but the address. Hence, the print needs dereference on the call to Get. Or am I doing it wrong?

@Thor-x86 Thor-x86 self-assigned this Sep 3, 2021
@Thor-x86 Thor-x86 added the bug Something isn't working label Sep 3, 2021
@Thor-x86
Copy link
Owner

Thor-x86 commented Sep 3, 2021

Pardon me, I didn't notice there is an open issue.

Seems like there is a behavioral change after several Go compiler update. Let me fix this problem. Thanks!

@Thor-x86
Copy link
Owner

Thor-x86 commented Sep 6, 2021

Could you tell me which version of Golang you are currently using?

Travis-CI is currently down, so I tested it on Ubuntu machine with Go v1.15 and it's working as documented. However, when I test it on Arch Linux with Go v1.17 I got the exact same problem. Probably fmt.Println won't resolve pointer's value anymore.

I'm going to update the new docs and fixes after current test executed

@coud
Copy link
Author

coud commented Sep 7, 2021

I'm using 1.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants