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 examples don't reflect proper usage #131

Open
stkrzysiak opened this issue Aug 10, 2022 · 1 comment
Open

README examples don't reflect proper usage #131

stkrzysiak opened this issue Aug 10, 2022 · 1 comment

Comments

@stkrzysiak
Copy link

The readme gives the following example:

a := New(WithShape(2, 2), WithBacking([]int{1, 2, 3, 4}))
fmt.Printf("a:\n%v\n", a)

I think this should be:

a := tensor.New(tensor.WithShape(2, 2), tensor.WithBacking([]int{1, 2, 3, 4}))
fmt.Printf("a:\n%v\n", a)

This is how gorgonia uses it currently.
I think the readme was probably using dot imports where the package name wasn't necessary but it is not recommended to do that.

Dot imports. If a program imports a standard package using import . "path", additional names defined in the imported package in future releases may conflict with other names defined in the program. We do not recommend the use of import . outside of tests, and using it may cause a program to fail to compile in future releases.

@yati-sagade
Copy link

As a new Go user, I also ran into this. But I appreciate the reduced clutter with the current style. Maybe the docs could just mention the import statement one needs at the top, and then assume the user adds the package prefix thereafter?

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