Closed henderjon closed 5 years ago
Can you provide a full reproducible example? This code snippet doesn’t show how the app is being used. When you say “it” hangs you don’t say what hangs. The app? The command? What do you mean by it hangs? I develop on a Mac, and haven’t seen hanging issues, but again you didn’t provide reproduction steps so it’s hard to help. Sorry.
Also, I’m not sure how you’re code example compiles either. Write takes a slice of bytes and you’re giving it a File struct.
I should have given you more detail. I put this together as an example to isolate my issue. Given two files main.go and index.txt in the root of a module.
package main
import (
"io"
"log"
"os"
"github.com/markbates/pkger"
)
func main() {
asset, err := pkger.Open("/index.txt")
if err != nil {
log.Fatalln("shouldn't get here")
}
io.Copy(os.Stdout, asset)
}
When I run pkger
(as in the example) it hangs.
Given that code I can’t reproduce. The command an app work as expected.
I upgraded to go version go1.13.4 darwin/amd64
and ran both the example I posted and your example from the README. Your example has been running for 11 min and the CPU% for the pkger
process on my MBP has slowly risen from 5.5 to 28.4 and it's still running.
I'll poke around more to see if I can generate more detail.
Please. Like I said I can’t repro but I’m not sure Mojave yet.
-- Mark Bates
On Nov 8, 2019, at 9:09 AM, Jon Henderson notifications@github.com wrote:
I upgraded to go version go1.13.4 darwin/amd64 and ran both the example I posted and your example from the README. Your example has been running for 11 min and the CPU% for the pkger process on my MBP has slowly risen from 5.5 to 28.4 and it's still running.
I'll poke around more to see if I can generate more detail.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Coworker of @henderjon here. I'm getting a different problem with his program above.
I've made a test repo here you can see with his code here: https://github.com/donatj/pkgertest
I'm running the following from $GOPATH/src/github.com/donatj/pkgertest
$ pkger
2019/11/08 12:36:44 exit status 1: can't load package: package .: C source files not allowed when not using cgo or SWIG: isomacprog.c
: /Users/jdonat/gocode/src/github.com/donatj/pkgertest
I have a file isomacprog.c
in my $HOME
which I'm both confused and concerned why it's trying to scan/read. I suspect @henderjon 's problem with it hanging is it's trying to scan his entire home directory or filesystem at large.
The C error would be coming from the Go tool chain, but we should be able to prevent the error. It shouldn’t be scanning the HOME directory, obviously. Can you run pkger parse and pkger info and paste?
This could be a Mojave bug. But I can’t be sure.
$ pkger parse 12:47:22
2019/11/08 12:49:26 exit status 1: can't load package: package .: C source files not allowed when not using cgo or SWIG: isomacprog.c
: /Users/jdonat/gocode/src/github.com/donatj/pkgertest
$ pkger info 1↵ 12:49:26
{
"Dir": "/Users/jdonat/gocode/src/github.com/donatj/pkgertest",
"ImportPath": "github.com/donatj/pkgertest",
"Module": {
"path": "github.com/donatj/pkgertest",
"main": true,
"dir": "/Users/jdonat/gocode/src/github.com/donatj/pkgertest",
"go_mod": "",
"go_version": ""
},
"Name": "main"
}
$pkger parse
hangs for me
$ pkger info 127[2019-11-08 12:49:11]
{
"Dir": "/Users/jehender/code/go/src/github.com/henderjon/test",
"ImportPath": "github.com/henderjon/test",
"Module": {
"path": "github.com/henderjon/test",
"main": true,
"dir": "/Users/jehender/code/go/src/github.com/henderjon/test",
"go_mod": "",
"go_version": ""
},
"Name": "main"
}
I think I found the issue. Can you try this PR https://github.com/markbates/pkger/pull/20
It does appear to have fixed the issue for me.
👍 That did it, working as expected.
Thank you!
Thanks for the bug! The repo helped me find the issue.
v0.10.1 has this fix
After
go install github.com/markbates/pkger/cmd/pkger
on my MBP/Mojave (10.14.6) usinggo version go1.13 darwin/amd64
pkger hangs when invoked. I've let it run for 10 min before CRL+Cing it.Code includes this usage:
Am I misunderstanding the usage?