foxcpp / maddy

✉️ Composable all-in-one mail server.
https://maddy.email
GNU General Public License v3.0
5.07k stars 244 forks source link

Bug: "go get" breaks: cannot find package crypto/ed25519 #242

Closed shuvammisra closed 4 years ago

shuvammisra commented 4 years ago

Describe the bug

"go get maddy" breaks with an error "package crypto/ed25519: unrecognized import path "crypto/ed25519" (import path does not begin with hostname)"

Steps to reproduce

I did a fresh git clone and tried doing a "go get" and got this error.

Environment information

My system is a Linux laptop

$ uname -a
Linux xyzpqr 4.15.0-106-generic #107-Ubuntu SMP Thu Jun 4 11:27:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$

I am doing my Go programming using this package:

golang                                     2:1.10~4ubuntu1                                  amd64        Go programming language compiler - metapackage
$ git log | head
commit ab948e149444536d5fd45d7b504ca266ecff0870
Author: fox.cpp <fox.cpp@disroot.org>
Date:   Sun May 31 20:48:34 2020 +0300

    Update minimal required Go version to 1.14

$ go version
go version go1.10.4 linux/amd64
$

Is the problem due to my using Go version 1.10.4 whereas the last commit says "Update minimal required Go version to 1.14". Is my Go version too old?

foxcpp commented 4 years ago

https://foxcpp.dev/maddy/tutorials/manual-installation/ mentions the minimal required version being Go 1.14. It also mentions the easy way to get Go 1.14 if your distribution does not include Go 1.14 toolchain.

foxcpp commented 4 years ago

Or if you prefer distribution packages, golang-1.14 is available since 20.04 LTS (focal) and you need to add /usr/lib/go-1.14/bin into PATH.

shuvammisra commented 4 years ago

I have now been able to download and install go1.14 on my laptop. The problem with "go get" persists.

$ go get -v maddy
package crypto/ed25519: unrecognized import path "crypto/ed25519" (import path does not begin with hostname)
$ 

If you need any information about my context or setup, please let me know. All the details I had given in my opening post still holds, other than the upgrading of the Go version to 1.14. I have downloaded the tar.gz from golang.org and extracted everything into /usr/local/go as instructed on that site. I have uninstalled the earlier installation of golang which came from the Ubuntu repository, to ensure that there are no multiple versions of go to confuse things.

foxcpp commented 4 years ago

That error looks strange, nonetheless I am not sure what you are trying to achieve using this command. If you cloned the repository and wish to not use build script, you need to run go build ./cmd/maddy from the repository root as described here.

shuvammisra commented 4 years ago

What you are describing in the "Manual Installation & Configuration" document does not work.

pranava:~/proj/go/src$ git clone https://github.com/foxcpp/maddy.git
Cloning into 'maddy'...
remote: Enumerating objects: 462, done.
remote: Counting objects: 100% (462/462), done.
remote: Compressing objects: 100% (292/292), done.
remote: Total 7178 (delta 264), reused 305 (delta 161), pack-reused 6716
Receiving objects: 100% (7178/7178), 1.91 MiB | 592.00 KiB/s, done.
Resolving deltas: 100% (4614/4614), done.
pranava:~/proj/go/src$ cd maddy
pranava:~/proj/go/src/maddy$ go build ./cmd/maddy
cmd/maddy/main.go:6:2: cannot find package "github.com/foxcpp/maddy" in any of:
    /usr/lib/go-1.10/src/github.com/foxcpp/maddy (from $GOROOT)
    /home/shuvam/proj/go/src/github.com/foxcpp/maddy (from $GOPATH)
pranava:~/proj/go/src/maddy$ echo $GOPATH
/home/shuvam/proj/go
pranava:~/proj/go/src/maddy$ echo $GOROOT

pranava:~/proj/go/src/maddy$

In case I am making any mistake here, can you please help?

This time, I did as the document asked: I just did a git clone, then a cd to the maddy directory, and tried a go build. I did not try any go get.

Please note that the error message mentions /var/lib/go-1.10/src/github.com.... but /var/lib/go-1.10 does not exist on my laptop. I used to have go 1.10 before, and I've completely uninstalled it. I am running go 1.14 now, and it's installed in /usr/local/go.

foxcpp commented 4 years ago

Seems like you have GOROOT somehow still pointing to an old directory. I am not sure why it happened but running export GOROOT=/usr/local/go should make it better. Also double-check that go command is indeed 1.14 since that error looks strange to me (as if it decoded to ignore go.mod file, Go 1.11 or newer should not do that).

shuvammisra commented 4 years ago

Yes, I think you're right, though the behaviour is hard to explain. I can clearly see that there is no GOROOT in the output of set or env commands, but I can also see a reference to /var/lib/go-1.10/ which indicates that there is some clash with the old Go 1.10 installation.

I will now hunt through my system and remove all traces I can find of any residual old Go packages, try the go build again, and come back.

shuvammisra commented 4 years ago

Success. I had to manually list all the dependent modules of go-1.10 and remove them individually using apt. After all that gone, and some cleanup to shell variables, my new Go installation (1.14) is now visible, and the build was successful. Thanks a lot for your patience.

Please close the issue after you see this message?

68CodingMonkeys commented 3 years ago

FYI:

New installation of go raspberry: go version go1.11.6 linux/arm

Linux *****cd 5.10.17-v7l+ #1421 SMP Thu May 27 14:00:13 BST 2021 armv7l GNU/Linux

*****: /usr/share $ ls -ld go lrwxrwxrwx 1 root root 7 Dec 29 2018 go -> go-1.11 drwxr-xr-x 7 root root 4096 Jul 2 06:23 go-1.11

(some formatting logic crippled my paste. Don't what it is and why it is a good idea assign something to * or # when dealing with unix command lines, but be assured there was a star, as you could derrive from the output).

*****/maddy $ go build ./cmd/maddy build github.com/foxcpp/maddy/cmd/maddy: cannot find module for path crypto/ed25519

***** $ go get -v maddy package maddy: unrecognized import path "maddy" (import path does not begin with hostname)

and since it is mentioned above:

$ cat /maddy/go.mod module github.com/foxcpp/maddy

go 1.14

require ( blitiri.com.ar/go/spf v1.2.0 github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/emersion/go-imap v1.0.6 github.com/emersion/go-imap-appendlimit v0.0.0-20190308131241-25671c986a6a github.com/emersion/go-imap-compress v0.0.0-20201103190257-14809af1d1b9 github.com/emersion/go-imap-idle v0.0.0-20201224103203-6f42b9020098 github.com/emersion/go-imap-move v0.0.0-20190710073258-6e5a51a5b342 github.com/emersion/go-imap-sortthread v1.2.0 github.com/emersion/go-imap-specialuse v0.0.0-20201101201809-1ab93d3d150e github.com/emersion/go-imap-unselect v0.0.0-20171113212723-b985794e5f26 github.com/emersion/go-message v0.14.1 github.com/emersion/go-milter v0.3.2 github.com/emersion/go-msgauth v0.6.5 github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21 github.com/emersion/go-smtp v0.15.0 github.com/foxcpp/go-dovecot-sasl v0.0.0-20200522223722-c4699d7a24bf github.com/foxcpp/go-imap-i18nlevel v0.0.0-20200208001533-d6ec88553005 github.com/foxcpp/go-imap-namespace v0.0.0-20200722130255-93092adf35f1 github.com/foxcpp/go-imap-sql v0.4.1-0.20200823124337-2f57903a7ed0 github.com/foxcpp/go-mockdns v0.0.0-20201212160233-ede2f9158d15 github.com/foxcpp/go-mtasts v0.0.0-20191219193356-62bc3f1f74b8 github.com/go-sql-driver/mysql v1.6.0 github.com/golang/protobuf v1.5.2 // indirect github.com/google/uuid v1.2.0 github.com/klauspost/compress v1.11.13 // indirect github.com/lib/pq v1.10.0 github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-sqlite3 v2.0.3+incompatible github.com/miekg/dns v1.1.41 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/pierrec/lz4 v2.6.0+incompatible // indirect github.com/prometheus/client_golang v1.10.0 github.com/prometheus/common v0.20.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/urfave/cli v1.22.5 golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 // indirect golang.org/x/text v0.3.6 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect )

Since this is a new installation, the "old version solution" does not work here. Suggestions?

Does the mod file implicate that the version I'm running is too low? (11.1 vs 14.1)

foxcpp commented 3 years ago

Yes, you are correct. maddy requires Go 1.14 or newer.

I believe golang-1.15 package is available on Raspbian.