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

go vet fails on Windows #1306

Open
hajimehoshi opened this issue Aug 16, 2020 · 6 comments
Open

go vet fails on Windows #1306

hajimehoshi opened this issue Aug 16, 2020 · 6 comments

Comments

@hajimehoshi
Copy link
Owner

hajimehoshi commented Aug 16, 2020

From https://github.com/hajimehoshi/ebiten/runs/990798566:

internal\glfw\glfw_windows.go:90:23: possible misuse of unsafe.Pointer
internal\glfw\glfw_windows.go:335:17: possible misuse of unsafe.Pointer
internal\glfw\glfw_windows.go:352:17: possible misuse of unsafe.Pointer
internal\glfw\glfw_windows.go:369:23: possible misuse of unsafe.Pointer
internal\glfw\glfw_windows.go:381:20: possible misuse of unsafe.Pointer
internal\glfw\glfw_windows.go:393:27: possible misuse of unsafe.Pointer
internal\glfw\glfw_windows.go:397:24: possible misuse of unsafe.Pointer
internal\glfw\native_windows.go:24:9: possible misuse of unsafe.Pointer
@hajimehoshi hajimehoshi added this to the v1.12.0 milestone Aug 16, 2020
@hajimehoshi
Copy link
Owner Author

See also #889

@hajimehoshi hajimehoshi removed this from the v1.12.0 milestone Aug 16, 2020
@hajimehoshi hajimehoshi added this to the v1.12.0 milestone Sep 3, 2020
@hajimehoshi
Copy link
Owner Author

golang/go#41205

Looks like it is hard or impossible to remove go-vet warnings? 🤔

@hajimehoshi hajimehoshi removed this from the v1.12.0 milestone Sep 3, 2020
@hajimehoshi
Copy link
Owner Author

# github.com/hajimehoshi/ebiten/v2/internal/glfwwin
internal\glfwwin\api_windows.go:1901:41: possible misuse of unsafe.Pointer
internal\glfwwin\api_windows.go:1910:41: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:275:24: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:293:45: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:480:24: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:510:19: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:537:22: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:562:22: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:581:42: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:595:49: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:616:22: possible misuse of unsafe.Pointer
internal\glfwwin\context_windows.go:621:9: possible misuse of unsafe.Pointer
internal\glfwwin\wglcontext_windows.go:279:22: possible misuse of unsafe.Pointer
internal\glfwwin\win32monitor_windows.go:35:25: possible misuse of unsafe.Pointer
internal\glfwwin\win32window_windows.go:583:22: possible misuse of unsafe.Pointer
internal\glfwwin\win32window_windows.go:590:29: possible misuse of unsafe.Pointer
internal\glfwwin\win32window_windows.go:1030:59: possible misuse of unsafe.Pointer
internal\glfwwin\win32window_windows.go:1038:25: possible misuse of unsafe.Pointer
internal\glfwwin\win32window_windows.go:1106:21: possible misuse of unsafe.Pointer
internal\glfwwin\win32window_windows.go:1129:26: possible misuse of unsafe.Pointer
internal\glfwwin\win32window_windows.go:1996:26: possible misuse of unsafe.Pointer

hajimehoshi added a commit that referenced this issue May 22, 2022
hajimehoshi added a commit that referenced this issue Oct 30, 2022
@hajimehoshi hajimehoshi added this to the v2.6.0 milestone Feb 6, 2023
@hajimehoshi
Copy link
Owner Author

golang/go#58625 will resolve this issue.

@hajimehoshi hajimehoshi removed this from the v2.6.0 milestone Jul 22, 2023
@hajimehoshi
Copy link
Owner Author

hajimehoshi commented Jul 22, 2023

If the above feature is available in Go 1.22, we would be able to use this in 3 or 4 years later. I'll set the milesone as v3 for now and let's adjust this when we change the minimum Go version we support.

@hajimehoshi hajimehoshi added this to the v3.0.0 milestone Jul 22, 2023
@JupiterRider
Copy link

Would this be a valid workaround?

Now:

func wglGetExtensionsStringARB(hdc _HDC) string {
	r, _, _ := syscall.Syscall(procWGLGetExtensionsStringARB, 1, uintptr(hdc), 0, 0)
	return windows.BytePtrToString((*byte)(unsafe.Pointer(r)))
}

Workaround:

func wglGetExtensionsStringARB(hdc _HDC) string {
	r, _, _ := syscall.Syscall(procWGLGetExtensionsStringARB, 1, uintptr(hdc), 0, 0)
	return windows.BytePtrToString(*(**byte)(unsafe.Pointer(&r)))
}

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

No branches or pull requests

2 participants