markbates / pkger

Embed static files in Go binaries (replacement for gobuffalo/packr)
MIT License
1.18k stars 60 forks source link

Can't find main package #86

Open Bios-Marcel opened 4 years ago

Bios-Marcel commented 4 years ago

Hey,

I am trying to use pkger for https://github.com/scribble-rs/scribble.rs

I have two folders I am trying to include, those being "resources" and "templates.

The following is displayed when running pkger list:

[marcel@o2 scribble.rs]$ go run github.com/markbates/pkger/cmd/pkger list -include /resources -include /templates
github.com/scribble-rs/scribble.rs
 > github.com/scribble-rs/scribble.rs:/resources
 > github.com/scribble-rs/scribble.rs:/resources/Montserrat-Bold.otf
 > github.com/scribble-rs/scribble.rs:/resources/Montserrat-Italic.otf
 > github.com/scribble-rs/scribble.rs:/resources/Montserrat-Medium.otf
 > github.com/scribble-rs/scribble.rs:/resources/Montserrat-Regular.otf
 > github.com/scribble-rs/scribble.rs:/resources/end-turn.wav
 > github.com/scribble-rs/scribble.rs:/resources/error.css
 > github.com/scribble-rs/scribble.rs:/resources/favicon.png
 > github.com/scribble-rs/scribble.rs:/resources/fill.svg
 > github.com/scribble-rs/scribble.rs:/resources/floodfill.js
 > github.com/scribble-rs/scribble.rs:/resources/lobby.css
 > github.com/scribble-rs/scribble.rs:/resources/lobby_players.css
 > github.com/scribble-rs/scribble.rs:/resources/plop.wav
 > github.com/scribble-rs/scribble.rs:/resources/rubber.svg
 > github.com/scribble-rs/scribble.rs:/resources/style.css
 > github.com/scribble-rs/scribble.rs:/resources/vanilla-js.png
 > github.com/scribble-rs/scribble.rs:/resources/words
 > github.com/scribble-rs/scribble.rs:/resources/words/de
 > github.com/scribble-rs/scribble.rs:/resources/words/en
 > github.com/scribble-rs/scribble.rs:/resources/words/fr
 > github.com/scribble-rs/scribble.rs:/resources/words/it
 > github.com/scribble-rs/scribble.rs:/resources/your-turn.wav
 > github.com/scribble-rs/scribble.rs:/templates
 > github.com/scribble-rs/scribble.rs:/templates/error.html
 > github.com/scribble-rs/scribble.rs:/templates/footer.html
 > github.com/scribble-rs/scribble.rs:/templates/lobby.html
 > github.com/scribble-rs/scribble.rs:/templates/lobby_create.html

which does seem correct. However, during runtime, it can't find the templates and throws the following error:

[marcel@o2 ~]$ ./scribblers 
panic: exit status 1: go: cannot find main module; see 'go help modules'

goroutine 1 [running]:
github.com/scribble-rs/scribble.rs/communication.readTemplateFile(0x8a609e, 0xa, 0x0, 0x0)
        /home/marcel/code/scribble.rs/communication/init.go:71 +0x1e0
github.com/scribble-rs/scribble.rs/communication.init.0()
        /home/marcel/code/scribble.rs/communication/init.go:22 +0x5d

The executable has been built with go build -o scribblers . and the pkged.go file was available and up-to-date, since i deleted it and created it freshly before building. I even explicitly specified the output folder with -o.

Is there anything I am not seeing here?

Bios-Marcel commented 4 years ago

If I specify every path as github.com/scribble-rs/sribble.rs:/XXX it works. E.g. I have to use the full module path every time. Is this how it should be?