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

goalng 1.21.0 have error not supper #90

Closed
pdxrlj opened this issue Aug 11, 2023 · 9 comments
Closed

goalng 1.21.0 have error not supper #90

pdxrlj opened this issue Aug 11, 2023 · 9 comments

Comments

@pdxrlj
Copy link

pdxrlj commented Aug 11, 2023

../../../go/pkg/mod/github.com/lukeroth/gdal@v0.0.0-20230422025444-05e99f726ff9/gdal.go:44:11: cannot define new methods on non-local type C.CPLErr
@chris
Copy link

chris commented Aug 15, 2023

I'm seeing this as well:

❯ go build
# github.com/lukeroth/gdal
../../../../go/pkg/mod/github.com/lukeroth/gdal@v0.0.0-20230422025444-05e99f726ff9/gdal.go:44:11: cannot define new methods on non-local type C.CPLErr
../../../../go/pkg/mod/github.com/lukeroth/gdal@v0.0.0-20230422025444-05e99f726ff9/gdal.go:60:11: cannot define new methods on non-local type C.OGRErr

@paulterinho
Copy link

Same here :(

@paulterinho
Copy link

@lukeroth Any recommendations about what I might be doing incorrectly? (P.S. great project!)

@chris
Copy link

chris commented Aug 17, 2023

To add a bit more - this started happening after upgrading from Go 1.20 to 1.21. I will also note that this is on macOS (I'm on macOS 13.5), and I'm not sure if other OS's are affected the same way. So, it appears it's something related to use with Go 1.21. I've used this project (agree, great!) for several years now, and with several Go versions, first time I've seen a breakage that I can remember. Going back to Go 1.20.7 alleviated the problem for me.

@paulterinho
Copy link

paulterinho commented Aug 17, 2023

@chris Timely update and advice! Thanks so much. Can confirm, 1.20 works!

@lukeroth
Copy link
Owner

In the most recent release notes, https://tip.golang.org/doc/go1.21, it says:

Cgo
In files that import "C", the Go toolchain now correctly reports errors for attempts to declare Go methods on C types.

It looks like 1.21 is reporting an error for something that was already incorrect but wasn't caught until now; we will need to wrap the C error types in Go error types here to declare this method.

@lukeroth
Copy link
Owner

OK, I've wrapped the CPLErr / OGRErr in a Go type to prevent these errors. Builds and passes tests on Go 1.21, GDAL 3.6.4.

@chris
Copy link

chris commented Aug 18, 2023

@lukeroth thanks for the quick fix - verified it resolves the compile errors for me.

@paulterinho
Copy link

@lukeroth Agreed with @chris, Thanks for the swift fix!

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

4 participants