You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to build on Ubuntu 22.04 LTS I get an error when building using go 1.18.1.
Build log using custom build script:
go clean
go build -ldflags "-X main.Version=4 -X main.Build=`git describe --tags --always`" -o mtmapprune
go: cannot find main module, but found .git/config in /home/juozas/mtmapprune
to create a module there, run:
go mod init
make: *** [Makefile:11: mtmapprune] Error 1
Script contents:
#!/bin/bash
# custom build script made by juozaspo, workaround for minetest-tools/mtmapprune#1
make clean
GOPATH=/usr/share/gocode make
Running go mod init github.com/minetest-tools/mtmapprune succeeds but then build fails with error go: could not create module cache: mkdir /usr/share/gocode/pkg: permission denied unless I change the go path. Also the global path in /usr/share/gocode cannot be used as build process tries to write there, and the building takes more time than expected, sqlite library must be installed using command go get github.com/mattn/go-sqlite3.
golang-go package is installed, golang-github-mattn-go-sqlite3-dev appears to be no longer needed, also the readme does not describe what other dependencies are needed, also there are a few new files created by commands above (go mod init, go get), for now I've added them to .gitignore on my fork.
The text was updated successfully, but these errors were encountered:
juozaspo
changed the title
Build error (go: cannot find main module, but found .git/config)
Build error (go: cannot find main module, but found .git/config), with workaround
Oct 23, 2022
juozaspo
changed the title
Build error (go: cannot find main module, but found .git/config), with workaround
Build error on recent go versions (go: cannot find main module, but found .git/config), with workaround
Oct 23, 2022
Trying to build on Ubuntu 22.04 LTS I get an error when building using go 1.18.1.
Build log using custom build script:
Script contents:
Running
go mod init github.com/minetest-tools/mtmapprune
succeeds but then build fails with errorgo: could not create module cache: mkdir /usr/share/gocode/pkg: permission denied
unless I change the go path. Also the global path in/usr/share/gocode
cannot be used as build process tries to write there, and the building takes more time than expected, sqlite library must be installed using commandgo get github.com/mattn/go-sqlite3
.golang-go
package is installed,golang-github-mattn-go-sqlite3-dev
appears to be no longer needed, also the readme does not describe what other dependencies are needed, also there are a few new files created by commands above (go mod init
,go get
), for now I've added them to.gitignore
on my fork.My updated fork: https://github.com/juozaspo/mtmapprune, with default branch set to testing, with go path removed from build script
The text was updated successfully, but these errors were encountered: