From 44faa49344be4dc92c0a40adfff37a392397133b Mon Sep 17 00:00:00 2001
From: Kirill Smelkov <kirr@nexedi.com>
Date: Tue, 2 Mar 2021 07:52:26 +0300
Subject: [PATCH] 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)
---
 software/neotest/gowork.cfg       | 237 ------------------------------
 software/neotest/software-dev.cfg |   7 +-
 software/neotest/software.cfg     |  24 ++-
 3 files changed, 18 insertions(+), 250 deletions(-)
 delete mode 100644 software/neotest/gowork.cfg

diff --git a/software/neotest/gowork.cfg b/software/neotest/gowork.cfg
deleted file mode 100644
index bb76450669d..00000000000
--- a/software/neotest/gowork.cfg
+++ /dev/null
@@ -1,237 +0,0 @@
-# Code generated by gowork-snapshot; DO NOT EDIT.
-
-# list of go git repositories to fetch
-[gowork.goinstall]
-depends_gitfetch  =
-    ${go_crawshaw.io_sqlite:recipe}
-    ${go_github.com_DataDog_czlib:recipe}
-    ${go_github.com_cznic_strutil:recipe}
-    ${go_github.com_davecgh_go-spew:recipe}
-    ${go_github.com_fsnotify_fsnotify:recipe}
-    ${go_github.com_golang_glog:recipe}
-    ${go_github.com_gwenn_gosqlite:recipe}
-    ${go_github.com_gwenn_yacr:recipe}
-    ${go_github.com_kisielk_og-rek:recipe}
-    ${go_github.com_kylelemons_godebug:recipe}
-    ${go_github.com_philhofer_fwd:recipe}
-    ${go_github.com_pkg_errors:recipe}
-    ${go_github.com_pkg_profile:recipe}
-    ${go_github.com_pmezard_go-difflib:recipe}
-    ${go_github.com_shamaton_msgpack:recipe}
-    ${go_github.com_soheilhy_cmux:recipe}
-    ${go_github.com_someonegg_gocontainer:recipe}
-    ${go_github.com_someonegg_gox:recipe}
-    ${go_github.com_stretchr_testify:recipe}
-    ${go_github.com_tinylib_msgp:recipe}
-    ${go_github.com_ttacon_chalk:recipe}
-    ${go_golang.org_x_crypto:recipe}
-    ${go_golang.org_x_mod:recipe}
-    ${go_golang.org_x_net:recipe}
-    ${go_golang.org_x_perf:recipe}
-    ${go_golang.org_x_sync:recipe}
-    ${go_golang.org_x_sys:recipe}
-    ${go_golang.org_x_text:recipe}
-    ${go_golang.org_x_tools:recipe}
-    ${go_golang.org_x_xerrors:recipe}
-    ${go_gopkg.in_yaml.v3:recipe}
-    ${go_lab.nexedi.com_kirr_go123:recipe}
-    ${go_lab.nexedi.com_kirr_neo:recipe}
-
-
-[go_crawshaw.io_sqlite]
-<= go-git-package
-go.importpath = crawshaw.io/sqlite
-repository    = https://github.com/crawshaw/sqlite
-revision      = v0.3.2-7-gc582b9de4f
-
-[go_github.com_DataDog_czlib]
-<= go-git-package
-go.importpath = github.com/DataDog/czlib
-repository    = https://github.com/DataDog/czlib
-revision      = 4bc9a24e37
-
-[go_github.com_cznic_strutil]
-<= go-git-package
-go.importpath = github.com/cznic/strutil
-repository    = https://github.com/cznic/strutil
-revision      = 529a34b1c1
-
-[go_github.com_davecgh_go-spew]
-<= go-git-package
-go.importpath = github.com/davecgh/go-spew
-repository    = https://github.com/davecgh/go-spew
-revision      = v1.1.1-1-gd8f796af33
-
-[go_github.com_fsnotify_fsnotify]
-<= go-git-package
-go.importpath = github.com/fsnotify/fsnotify
-repository    = https://github.com/fsnotify/fsnotify
-revision      = 7f4cf4dd2b
-
-[go_github.com_golang_glog]
-<= go-git-package
-go.importpath = github.com/golang/glog
-repository    = https://github.com/golang/glog
-revision      = 23def4e6c1
-
-[go_github.com_gwenn_gosqlite]
-<= go-git-package
-go.importpath = github.com/gwenn/gosqlite
-repository    = https://github.com/gwenn/gosqlite
-revision      = 24878be1a2
-
-[go_github.com_gwenn_yacr]
-<= go-git-package
-go.importpath = github.com/gwenn/yacr
-repository    = https://github.com/gwenn/yacr
-revision      = bbe82c1f4d
-
-[go_github.com_kisielk_og-rek]
-<= go-git-package
-go.importpath = github.com/kisielk/og-rek
-repository    = https://github.com/kisielk/og-rek
-revision      = 24bb08c22e
-
-[go_github.com_kylelemons_godebug]
-<= go-git-package
-go.importpath = github.com/kylelemons/godebug
-repository    = https://github.com/kylelemons/godebug
-revision      = fa7b53cdfc
-
-[go_github.com_philhofer_fwd]
-<= go-git-package
-go.importpath = github.com/philhofer/fwd
-repository    = https://github.com/philhofer/fwd
-revision      = 414ae1bb9e
-
-[go_github.com_pkg_errors]
-<= go-git-package
-go.importpath = github.com/pkg/errors
-repository    = https://github.com/pkg/errors
-revision      = v0.8.1-31-g614d223910
-
-[go_github.com_pkg_profile]
-<= go-git-package
-go.importpath = github.com/pkg/profile
-repository    = https://github.com/pkg/profile
-revision      = v1.5.0-1-g3704c8d233
-
-[go_github.com_pmezard_go-difflib]
-<= go-git-package
-go.importpath = github.com/pmezard/go-difflib
-repository    = https://github.com/pmezard/go-difflib
-revision      = v1.0.0-4-g5d4384ee4f
-
-[go_github.com_shamaton_msgpack]
-<= go-git-package
-go.importpath = github.com/shamaton/msgpack
-repository    = https://github.com/shamaton/msgpack
-revision      = 29a4ba0bb9
-
-[go_github.com_soheilhy_cmux]
-<= go-git-package
-go.importpath = github.com/soheilhy/cmux
-repository    = https://github.com/soheilhy/cmux
-revision      = 8a8ea3c539
-
-[go_github.com_someonegg_gocontainer]
-<= go-git-package
-go.importpath = github.com/someonegg/gocontainer
-repository    = https://github.com/someonegg/gocontainer
-revision      = 24fb283ab9
-
-[go_github.com_someonegg_gox]
-<= go-git-package
-go.importpath = github.com/someonegg/gox
-repository    = https://github.com/someonegg/gox
-revision      = c9bfdf8eb4
-
-[go_github.com_stretchr_testify]
-<= go-git-package
-go.importpath = github.com/stretchr/testify
-repository    = https://github.com/stretchr/testify
-revision      = v1.2.2-210-g54d05a4e18
-
-[go_github.com_tinylib_msgp]
-<= go-git-package
-go.importpath = github.com/tinylib/msgp
-repository    = https://github.com/tinylib/msgp
-revision      = 87c1ec45d5
-
-[go_github.com_ttacon_chalk]
-<= go-git-package
-go.importpath = github.com/ttacon/chalk
-repository    = https://github.com/ttacon/chalk
-revision      = v0.1-3-g22c06c80ed
-
-[go_golang.org_x_crypto]
-<= go-git-package
-go.importpath = golang.org/x/crypto
-repository    = https://go.googlesource.com/crypto
-revision      = 5c72a88397
-
-[go_golang.org_x_mod]
-<= go-git-package
-go.importpath = golang.org/x/mod
-repository    = https://go.googlesource.com/mod
-revision      = ce943fd024
-
-[go_golang.org_x_net]
-<= go-git-package
-go.importpath = golang.org/x/net
-repository    = https://go.googlesource.com/net
-revision      = 62affa334b
-
-[go_golang.org_x_perf]
-<= go-git-package
-go.importpath = golang.org/x/perf
-repository    = https://go.googlesource.com/perf
-revision      = d949658356
-
-[go_golang.org_x_sync]
-<= go-git-package
-go.importpath = golang.org/x/sync
-repository    = https://go.googlesource.com/sync
-revision      = 6e8e738ad2
-
-[go_golang.org_x_sys]
-<= go-git-package
-go.importpath = golang.org/x/sys
-repository    = https://go.googlesource.com/sys
-revision      = aee5d888a8
-
-[go_golang.org_x_text]
-<= go-git-package
-go.importpath = golang.org/x/text
-repository    = https://go.googlesource.com/text
-revision      = v0.3.3-2-ga8b4671254
-
-[go_golang.org_x_tools]
-<= go-git-package
-go.importpath = golang.org/x/tools
-repository    = https://go.googlesource.com/tools
-revision      = ba800b16d8
-
-[go_golang.org_x_xerrors]
-<= go-git-package
-go.importpath = golang.org/x/xerrors
-repository    = https://go.googlesource.com/xerrors
-revision      = 5ec99f83af
-
-[go_gopkg.in_yaml.v3]
-<= go-git-package
-go.importpath = gopkg.in/yaml.v3
-repository    = https://gopkg.in/yaml.v3
-revision      = v2.1.1-97-geeeca48fe7
-
-[go_lab.nexedi.com_kirr_go123]
-<= go-git-package
-go.importpath = lab.nexedi.com/kirr/go123
-repository    = https://lab.nexedi.com/kirr/go123.git
-revision      = c8d9907ef7
-
-[go_lab.nexedi.com_kirr_neo]
-<= go-git-package
-go.importpath = lab.nexedi.com/kirr/neo
-repository    = https://lab.nexedi.com/kirr/neo.git
-revision      = v1.12-2791-gf3effa6c53
diff --git a/software/neotest/software-dev.cfg b/software/neotest/software-dev.cfg
index 82438494edf..48375fd48c8 100644
--- a/software/neotest/software-dev.cfg
+++ b/software/neotest/software-dev.cfg
@@ -2,12 +2,7 @@
 [buildout]
 extends = software.cfg
 
-
-[go_lab.nexedi.com_kirr_go123]
-branch	= master
-revision=
-
-[go_lab.nexedi.com_kirr_neo]
+[neo]
 branch	= t
 revision=
 
diff --git a/software/neotest/software.cfg b/software/neotest/software.cfg
index 678cb0bceb0..72266363692 100644
--- a/software/neotest/software.cfg
+++ b/software/neotest/software.cfg
@@ -8,7 +8,6 @@ extends =
     ../../stack/slapos.cfg
     ../neoppod/software-common.cfg
     ../../component/golang/buildout.cfg
-    gowork.cfg
     ../../component/sqlite3/buildout.cfg
     ../../component/zlib/buildout.cfg
     ../../component/wendelin.core/buildout.cfg
@@ -49,12 +48,23 @@ parts =
     instance.cfg
 
 
-# go packages to install (+ automatically their dependencies)
+[neo]
+<= go-git-package
+go.importpath = lab.nexedi.com/kirr/neo
+repository    = https://lab.nexedi.com/kirr/neo.git
+revision      = v1.12-3107-gf278d611
+
+[goperf]
+<= go-git-package
+go.importpath = golang.org/x/perf
+repository    = https://lab.nexedi.com/kirr/go.perf.git
+revision      = e8bebf9314da
+
+# go programs to install
 [gowork]
 install =
-    lab.nexedi.com/kirr/neo/go/...
-    github.com/pkg/profile
-    golang.org/x/perf/cmd/benchstat
+    ${neo:location}/go:./...
+    ${goperf:location}:./cmd/benchstat
 
 cpkgpath =
     ${sqlite3:location}/lib/pkgconfig
@@ -62,7 +72,7 @@ cpkgpath =
 
 # dev-install neo from go checkout
 [neoppod-develop]
-setup   = ${go_lab.nexedi.com_kirr_neo:location}
+setup   = ${neo:location}
 
 
 # neotest-env.sh + neotest wrapper
@@ -99,7 +109,7 @@ template = inline:
   [tnxdtest]
   recipe = plone.recipe.command
   stop-on-error = yes
-  command = ln -s -t $${directory:t} ${gowork:src}/lab.nexedi.com/kirr/neo/go/neo/t/.nxdtest
+  command = ln -s -t $${directory:t} ${neo:location}/go/neo/t/.nxdtest