andreaskoch / allmark

A cross-platform markdown web server
https://allmark.io
Other
314 stars 73 forks source link

Current binary doesn't work on OSX 10.11.1 #1

Closed npostulart closed 8 years ago

npostulart commented 8 years ago

Using the binary provided I get the error

panic: Cannot determine the current users home direcotry. Error: user: Current not implemented on darwin/amd64

goroutine 1 [running]:
allmark.io/modules/common/config.init.1()
    /srv/allmark.io/repo/src/allmark.io/modules/common/config/config.go:67 +0x16a
allmark.io/modules/common/config.init()
    /srv/allmark.io/repo/src/allmark.io/modules/common/config/json.go:33 +0x86
main.init()
    /srv/allmark.io/repo/src/allmark.io/cmd/allmark/allmark.go:247 +0x47

Building the application from source works for me even if the test run results in an error.

❯ go run make.go -test
Testing package 01 of 14: allmark.io/modules/common/config
ok      allmark.io/modules/common/config    0.011s
Testing package 02 of 14: allmark.io/modules/common/logger/console
ok      allmark.io/modules/common/logger/console    0.005s
Testing package 03 of 14: allmark.io/modules/common/route
ok      allmark.io/modules/common/route 0.005s
Testing package 04 of 14: allmark.io/modules/common/tree
ok      allmark.io/modules/common/tree  0.007s
Testing package 05 of 14: allmark.io/modules/common/util/dateutil
ok      allmark.io/modules/common/util/dateutil 0.006s
Testing package 06 of 14: allmark.io/modules/common/util/hashutil
ok      allmark.io/modules/common/util/hashutil 0.006s
Testing package 07 of 14: allmark.io/modules/services/converter/markdowntohtml/postprocessor
# allmark.io/modules/services/converter/markdowntohtml/postprocessor
src/allmark.io/modules/services/converter/markdowntohtml/postprocessor/image_test.go:13:2: cannot find package "allmark.io/modules/services/converter/markdowntohtml/common" in any of:
    /usr/local/Cellar/go/1.5.1/libexec/src/allmark.io/modules/services/converter/markdowntohtml/common (from $GOROOT)
    XXX/allmark/src/allmark.io/modules/services/converter/markdowntohtml/common (from $GOPATH)
FAIL    allmark.io/modules/services/converter/markdowntohtml/postprocessor [setup failed]
Error running go test allmark.io/modules/services/converter/markdowntohtml/postprocessor: exit status 1
exit status 1
andreaskoch commented 8 years ago

Yes you are right. I have the same issue:

screen shot of allmark panicking on Mac OS 2015-11-16 at 21:46:46 with the error "user: Current not implemented on darwin/amd64"

I think I did not notice it before because I mostly develop on my Mac and never use the cross-compiled version from allmark.io.

The Error: user: Current not implemented on darwin/amd64 error seems to be a known golang issue: https://github.com/golang/go/issues/6376

... and they closed it as "WorkingAsIntended" :disappointed: Apparently the solution is to build natively on Mac OS.

And that's what I did for now. I exchanged the binary for Mac OS with one that I built on my Mac. If you download the darwin/amd64 binary again it should work:

curl -O https://allmark.io/bin/darwin/amd64/allmark
chmod +x allmark
./allmark

screenshot of the fixed version of allmark (Version: 2015-11-16-cb31f6a built on a Mac)

But since this is not a good solution I will further investigate alternative solutions for determining the users home directory. Until then I will leave this issue open.

andreaskoch commented 8 years ago

It's fixed.

The reason for the error was that I did not anticipate user.Current() to fail during cross compilation. Apparently os/user relies on cgo, and cgo is disabled for cross compiling.

Since this is, for some reasons unclear to me, intended behaviour by go (see: golang/go#6376) I used Mitchell Hachimoto's go-homedir library for determining the current users home directory path instead of using user.Current().

If you now download the binaries for Mac OS from allmark.io/bin/darwin it should work.