neotest: Rework to use Go modules
GOPATH is going to go away in Go 1.17 and most of in-tree SlapOS things are already built using modules - including upcoming wendelin.core 2 that also builds/uses NEO/go. This way maintaining GOPATH-based approach becomes just unneccesary burden (modulo development, where it is still needed sometime unfortunately https://github.com/golang/go/issues/37755#issuecomment-771927771)
-
Owner
@jerome, @alain.takoudjou, FYI, if I'm not mistaken, now gitlab remains the only software-release that uses Go in GOPATH mode. Please don't hesitate to contact if you need advice on how to convert gitlab as well. Writing just in case - there is no pressure with that. Also for the reference - I've just added module support to git-backup in kirr/git-backup@3c804105.
Kirill
-
Owner
@alain.takoudjou, @jerome, for the reference, contrary to what they have been saying, support for GOPATH is still present in Go 1.22 and they say that the core of it will stay supported forever.
-
Owner
This way there are still two options: either continue to use GOPATH based approach to build git-backup, or to switch to module-based build. I think the first option is easier even if module-based builds are more preferrable in the long term.
-
Maintainer
Thank you @kirr but if I want to switch to latest git-backup I will need to use module-based it seems.
for now I'm trying to understand how I can convert this: https://lab.nexedi.com/nexedi/slapos/-/blob/master/software/gitlab/software.cfg#L225
There is this error to build latest git-backup :
# pkg-config --cflags --static -- /srv/slapgrid/slappart74/srv/runner/software/60c2ddef4a92979269ccdf7dc6fb1a39/go.work/pkg/mod/github.com/libgit2/git2go/v31@v31.4.12/static-build/install/lib/pkgconfig/libgit2.pc 2024-04-10 17:52:48 slapos[2906094] INFO Failed to open '/srv/slapgrid/slappart74/srv/runner/software/60c2ddef4a92979269ccdf7dc6fb1a39/go.work/pkg/mod/github.com/libgit2/git2go/v31@v31.4.12/static-build/install/lib/pkgconfig/libgit2.pc': No such file or directory
While
libgit2.pc
is installed here:/srv/slapgrid/slappart74/srv/runner/software/60c2ddef4a92979269ccdf7dc6fb1a39/go.work/src/github.com/libgit2/git2go/static-build/install/lib/pkgconfig/
Is there possible to build latest git-backup without module-based ? Last time I tried, there was error with some dependecies (
golang.org/x/crypto
) -
Owner
Hello @alain.takoudjou. First of all I'm sorry it took me long to come back to you.
It is still possible to do the build in GOPATH mode. For this one needs to clone git2go the usual way, and to manually add
v31
->.
symlink inside its tree, so that new git2go imports with version ("github.com/libgit2/git2go/v31"
) could be resolved correctly in GOPATH mode as well.Then on needs to go to git2go tree and follow https://github.com/libgit2/git2go?tab=readme-ov-file#main-branch-or-vendored-static-linking to make libgit2+git2go build.
Then inside git-backup,
go build -tags
static works ok.I've just checked myself that it can be done with Go 1.22 .
Hope it helps a bit,
Kirill