I’m trying to get portal running locally, so I could help with the UX stuff, but have some problems get it running.
OS: macOS Big Sur 11.0.1
GO: 1.15.5
node: 14.14
First I got this error when building the project:
Error: Command failed: /usr/local/Cellar/go/1.15.5/libexec/bin/go build -o /Users/miikat/src/go/p2p-git-portal-poc/src/main.go.wasm /Users/miikat/src/go/p2p-git-portal-poc/src/main.go
go: github.com/MichaelMure/git-bug@v0.0.0-20201205005248-54d123c6753d: parsing /home/mrh/src/go/src/github.com/happybeing/git-bug/go.mod: open /home/mrh/src/go/src/github.com/happybeing/git-bug/go.mod: no such file or directory
I then cloned the repos what I found in go.mod -file(git-bug, keyring, webpack-golang-wasm-async-loader) and modified the replace locations to match my local machine. After that I got this error:
So you should not need to clone these and have local copies unless you plan to work on them. For that case you would change the redirect statements to point to the local paths on your Mac as explained in the README here. But as noted, you probably don’t need that.
So first check what’s in your go.mod to make sure there’s a suitable replace for all three.
Note that Golang can be a bit tricky sometimes. It auto edits the import and require sections for you if you don’t get it right, but often messes them up as a result.
EDIT: as you may have noticed, here’s the source of the problem in go.mod, I’ve accidentally checked in to version I’m using for development. The following local paths need to have the /home/mrh/src/go/src/ removed. Please try that and let me know how you get on:
Thanks happybeing. Using the main branch. Commented out the replace statements that points to local paths. This is how go.mod looks now:
module github.com/happybeing/p2p-git-portal-poc
go 1.13
require (
github.com/MichaelMure/git-bug v0.0.0-20201205005248-54d123c6753d
github.com/go-git/go-billy/v5 v5.0.0
github.com/go-git/go-git/v5 v5.2.0
github.com/happybeing/p2p-git-portal-poc/src/repo v0.0.0
github.com/happybeing/webpack-golang-wasm-async-loader/gobridge v0.0.0-20201125123737-917b0db1c9a8
)
// Use forks with Go/wasm support
replace github.com/go-git/go-git/v5 => github.com/happybeing/go-git/v5 v5.2.1
replace github.com/go-git/go-billy/v5 => github.com/happybeing/go-billy/v5 v5.0.1
// For development with local go-git/go-billy and wasm plugin:
//replace github.com/MichaelMure/git-bug => /home/mrh/src/go/src/github.com/happybeing/git-bug
//replace github.com/99designs/keyring => /home/mrh/src/go/src/github.com/happybeing/keyring
//replace github.com/happybeing/p2p-git-portal-poc/src/repo => /home/mrh/src/wasm/p2p-git-portal-poc/src/repo
// Dependencies of git-bug which require tweaks for wasm
// replace github.com/99designs/keyring => /home/mrh/src/go/src/github.com/happybeing/keyring
// replace github.com/go-git/go-git/v5 => /home/mrh/src/go/src/github.com/happybeing/go-git
// replace github.com/go-git/go-billy/v5 => /home/mrh/src/go/src/github.com/happybeing/go-billy
// To develop with a local version of the plugin you need to:
// - uncomment the following 'replace'
// - `yarn link` in your local development copy of the plugin
// - `yarn link golang-wasm-async-loader2` in ./p2p-git-portal-poc
// replace github.com/happybeing/webpack-golang-wasm-async-loader/gobridge => /home/mrh/src/go/src/github.com/happybeing/webpack-golang-wasm-async-loader/gobridge
This is the error I get now. This might be some mac git thing…
go: github.com/happybeing/p2p-git-portal-poc/src/repo@v0.0.0: reading github.com/happybeing/p2p-git-portal-poc/src/repo/src/repo/go.mod at revision src/repo/v0.0.0: unknown revision src/repo/v0.0.0
No it’s not a Mac thing. You’re on the right track but I’ll have to leave this until tomorrow. Feel free to wait, or see if you can fix it by redirecting the to the github.com/happybeing forks. See my not quite correct EDIT to my first reply above, or wait for me to fix it tomorrow, up to you!
Sorry to leave you with this. I’m pretty sure I messed up by checking in my development go.mod (when I merged my development branch) so what you need is an older one from main branch than one from a different branch.
If you like, you could try this one, or as I say wait for me to sort it out tomorrow. I’m on my tablet now, so I can’t test it out yet:
Well done for getting this far. Golang is quite tricky in this area and it easily throws you off and doesn’t give much help with this.
I’m struggling to get this working with replacements pointing to github.com/happybeing at the moment so I suggest using local forks as we should find that easier to get working. Once you have the forks, and they are located in the correct place, you would need to modify p2p-git-portal-poc/src/go.mod to point to those rather than the paths on my system.
I’m not sure where the forks will need to be on your system. This needs to be in a particular place, in my case I used /home/mrh/src/go/src/ which is non-standard because I like all my code under ~/src but I can’t remember how this is set.
The only thing in my environment is that my $PATH contains /home/mrh/src/go/bin, where the bin directory is next to the src/ that you need to locate. If I do ls /mrh/src/go it contains only the following: bin/ pkg/ src/
When you locate that src/, you would create a path corresponding to your github.com/<your-account> with mkdir -p github.com/<your-account> then cd github.com/<your-account> and git clone your forks of my git-bug, go-git and go-billy so you have paths for each beginning .../src/github.com/<your-account>/git-bug etc.
You may also need forks of github.com/happybeing/keyring and github.com/happybeing/webpack-golang-wasm-async-loader so start with those too for now.
Once you have that set up, check out the main branch p2p-git-portal-poc/src/go.mod and modify it the replacements pointing to paths beginning with /home/mrh/src/go/src/github.com/happybeing begin with your <path-to-src>/github.com/<your-account> path. Then yarn build and hope for the best!
I think I had this working as in the README instructions using the references to repos on github, but have obviously broken that at some point so it is inconvenient to anyone to use my forks for now. If you can get things working as I’ve described we can leave this until the forks settle down a bit and I’ll just have to let you know when you need to pull changes.
Got it working now! I guess I had wrong fork branches yesterday. I didn’t have to fork myself anything, just added master branches to go.mod replaces. This is how my go.mod looks now:
module github.com/happybeing/p2p-git-portal-poc
go 1.13
require (
github.com/MichaelMure/git-bug v0.0.0-20201205005248-54d123c6753d
github.com/go-git/go-billy/v5 v5.0.0
github.com/go-git/go-git/v5 v5.2.0
github.com/happybeing/p2p-git-portal-poc/src/repo v0.0.0
github.com/happybeing/webpack-golang-wasm-async-loader/gobridge v0.0.0-20201125123737-917b0db1c9a8
)
// Use forks with Go/wasm support
replace github.com/go-git/go-git/v5 => github.com/happybeing/go-git/v5 v5.2.1
replace github.com/go-git/go-billy/v5 => github.com/happybeing/go-billy/v5 v5.0.1
// For development with local go-git/go-billy and wasm plugin:
replace github.com/MichaelMure/git-bug => github.com/happybeing/git-bug master
replace github.com/99designs/keyring => github.com/happybeing/keyring master
replace github.com/happybeing/p2p-git-portal-poc/src/repo => /Users/miikat/src/go_wasm/p2p-git-portal-poc/src/repo
// Dependencies of git-bug which require tweaks for wasm
// replace github.com/99designs/keyring => /home/mrh/src/go/src/github.com/happybeing/keyring
// replace github.com/go-git/go-git/v5 => /home/mrh/src/go/src/github.com/happybeing/go-git
// replace github.com/go-git/go-billy/v5 => /home/mrh/src/go/src/github.com/happybeing/go-billy
// To develop with a local version of the plugin you need to:
// - uncomment the following 'replace'
// - `yarn link` in your local development copy of the plugin
// - `yarn link golang-wasm-async-loader2` in ./p2p-git-portal-poc
//replace github.com/happybeing/webpack-golang-wasm-async-loader/gobridge => /Users/miikat/src/go/webpack-golang-wasm-async-loader/gobridge
Thanks for solving this, for the PR and this important learning. A great start!
Edit: @Miguelo, apparently you can specify a few things instead of a version. I wish the error messages didn’t lead you to a dead end, see: You're invited to talk on Matrix
I’m not aware of any Windows specific issues. If you use a proxy it should be fine regardless of operating system. If you can’t do that yourself, try entering https://cors.isomorphic-git.org/ in the CORS proxy box before cloning. I just tried it with the live version at http://gitch.happybeing.com/ (in Firefox) and it worked fine.
I suggest creating a new repo first, and wait until this appears as it takes a little while to load the bundle the first time. Then try cloning. You can open the browser console to see more about what’s going on (as I don’t have any progress indication yet).
I’ve added the ability to upload a repository and @Miguelo has been learning Svelte, Golang and beginning to work on a more github like UI so you may not have to look at my ugly thing much longer.
Note: upload repository is only viable for fairly small repositories as there seems to be a limit of a few thousand files in one go. #issue
I’ve also updated the README so any proof reading and suggestions to improve that are welcome.