Closed ptxmac closed 1 year ago
Hi @ptxmac, thanks for reporting this issue! Sorry for taking so long to reply as I'm out of town. I will try to implement a solution around end of next week once I'm back, perhaps by renaming the directories. Will post an update here then!
Any update? I think it would be fine if we just replace the .
with _
Hi @ptxmac, sorry I was actually just starting to work on this! Could you let me know how I can reproduce the issue? I might just end up following your suggestion in order to fix it.
Sure, create a new project that use go modules. E.g.
main.go
:
package main
import "github.com/veandco/go-sdl2/sdl"
func main() {
sdl.GetRevision()
}
and go.mod
:
module github.com/ptxmac/go-sdl2-get-bug
go 1.20
require github.com/veandco/go-sdl2 v0.4.33
Then run go get -u
That's strange.. go get -u
succeeded for me using the same configuration as yours. Is there something else that I should do?
Perhaps you're using a different version of go? This bug appears on go1.20
I've created a quick sample project here: https://github.com/ptxmac/go-sdl2-get-bug
My Go version is go version go1.20.2 darwin/arm64
. I cloned the sample project and ran go get -u
there as well but it didn't produce any error.
Very strange, I'm using go version go1.20.3 darwin/arm64
But I also saw it on v1.20.2
Maybe if you use go get -u ./...
instead?
I tried with go get -u ./...
but the error doesn't show up. I will keep trying to see if I can reproduce it.
Very strange... perhaps try removing go-sdl from the mod cache in go env GOMODCACHE
It still runs fine...I also tried with a new macOS user with an empty home directory.
So apparently it's something with my setup - I just tried an empty user, and there it works fine... 🙃
Oh... if you happen to find the cause, please let me know! I would be interested to know why that error happened and perhaps add that information to the README.
Yeah, I've found the code that returns the error, and from what I can understand it "should" be illegal to use dots because it might conflict with VCS systems.
But why that code is only getting triggered by my setup is very strange!
I figured it out!
I had to step through go get
in a debugger, but finally discovered the difference. I have GONOPROXY
configured!
From my understanding the go get
command will look up modules on a proxy server to avoid putting too much load on the repository. If GONOPROXY
is set it will go directly to the repository instead.
I guess the proxy server ignores files starting with a dot when it indexes a repository.
You can test it out with GONOPROXY=test go get -u
It also happens if GONOSUMDB
is set. Basically if you have a project that depends on private packages, then it will break
Hi @ptxmac, thank you very much for finding the way to reproduce it! I renamed the .go-sdl2-libs
directory to _libs
and pushed that change to the test
branch. It seems to work for me so let me know if it works for you too. I will tag a new version once it's confirmed to fix it 🙂
Works perfect for me too!
Okay, I have pushed the tag v0.4.34
!
After 9515279986a1fc8d043e301522c565a0b8b56480 it's no longer possible to update all dependencies in a project that use go-sdl2.
Normally this would be done by running
go get -u ./...
, but after the dummy package was added the go command fails:Go version: 1.20.2 Go-SDL2 version: 0.4.33 OS: macos Architecture: arm64