Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

obsolete documentation #323

Open
IvanTejo-ymas opened this issue Jun 9, 2021 · 5 comments
Open

obsolete documentation #323

IvanTejo-ymas opened this issue Jun 9, 2021 · 5 comments
Assignees
Labels

Comments

@IvanTejo-ymas
Copy link

PS C:\Ivan\proyectos\go\src\astilectron> go run main.go
astikit: starting worker...
Starting...
Provisioning...
Provisioning Astilectron...
Removing directory C:\Users\INFORM2\AppData\Roaming\dsfgsdf\vendor\astilectron
Downloading https://github.com/asticode/astilectron/archive/v<version of Astilectron to utilize such as 0.33.0>.zip into C:\Users\INFORM2\AppData\Roaming\dsfgsdf\vendor\astilectron-v<version of Astilectron to utilize such as 0.33.0>.zip
Removing C:\Users\INFORM2\AppData\Roaming\dsfgsdf\vendor\astilectron-v<version of Astilectron to utilize such as 0.33.0>.zip...
astikit: worker is now waiting...
fatal error: all goroutines are asleep - deadlock!

sadly, this works more like a virus removing, installing god-knows where and why....
my $path is ok.
imposible to start the examples. basic guide don't works.
follow https://medium.com/@asticode/how-to-add-a-gui-to-your-golang-app-in-5-easy-steps-c25c99d4d8e0 and more of the same.
probably obsolete to old Go versions or before go.mod exist

@asticode asticode self-assigned this Jun 9, 2021
@asticode
Copy link
Owner

asticode commented Jun 9, 2021

Thanks for the issue, I'd be happy to help you use this project properly.

  1. Is what you pasted the real output you're getting?
  2. If so, can you share the code that gives this ouput?

sadly, this works more like a virus removing, installing god-knows where and why....

This is however a very serious accusation that I find very hurtful since it's not corroborated by any proof. I'd be happy to get your precise analysis on what is behaving like a virus in this projet. Everything is open source therefore you shouldn't have any problem pointing to the right place.

@IvanTejo-ymas
Copy link
Author

i'm not an expert programmer to pointing to the right place.
i'm just following the instructions, sorry.
probably i've done it wrong but they looks like easy to follow. don't take it as accusation, just a point of view.
probably i'm wrong. and english is not my language so i sorry for my hurtful words.
what you see above was copy/paste the real output.

$ echo $GOPATH
C:\Ivan\proyectos\go

and this was the main.go i was running

package main
import (
	"github.com/asticode/go-astilectron"
	"log"
	"os"
)

func main() {
	// Initialize astilectron
	var a, _ = astilectron.New(log.New(os.Stderr, "", 0), astilectron.Options{
		AppName:            "dsfgsdf",
		AppIconDefaultPath: "favicon-16.png", // If path is relative, it must be relative to the data directory // Same here
		BaseDirectoryPath:  "dependencias",
		VersionAstilectron: "<version of Astilectron to utilize such as `0.33.0`>",
		VersionElectron:    "<version of Electron to utilize such as `4.0.1` | `6.1.2`>",
	})
	defer a.Close()

	// Start astilectron
	a.Start()

	// Blocking pattern
	a.Wait()
}

probably this not helps you much. i was following steps from

I have tried to make it work for 2 days and in the end I gave up. I think that is not the code what is wrong. probably the documentation not enought accurate? clear? obsolete? i'm not an expert.
but this code should not remove anything from c:\users
Removing directory C:\Users\INFORM2\AppData\Roaming\dsfgsdf\vendor\astilectron

@asticode
Copy link
Owner

asticode commented Jun 9, 2021

No worries, that makes sense now.

First off, I think you're better off copy/pasting the example to start understanding how this project works. That's why I mentioned it at the top of the README but I do agree it's not highlighted enough.

Regarding but this code should not remove anything from c:\users, basically what it's doing is cleaning up after itself: indeed, in order to use Electron, this project downloads it in it's vendor directory (which in your case is in C:\Users\INFORM2\AppData\Roaming\dsfgsdf\vendor. See how the folder is located in AppData which is the recommended location to store app data on Windows). But if anything fails, it makes sure to clean up what has been downloaded to avoid using useless disk space.

There are several mistakes in your code:

  1. If you want to use VersionAstilectron and VersionElectron you need to use valid versions of the form vx.y.z (for instance v1.2.3 (this version doesn't exist, it's just to show you how it should look like)). My advice is not to use those attributes and remove them from your Option, that way the lib will select automatically the best ones.
  2. In your code, once astilectron has started, you don't do anything (create a window, a menu, etc.) therefore go is right to kill your binary after some time. What you need to do is create a window with something like this

Once you start using valid versions and actually do something with astilectron (create a window, a menu, ...) it should work properly.

@IvanTejo-ymas
Copy link
Author

Thank you for your understanding
The first example works well and i have done some windows and forms with it.
My problems have started when i try to follow this one and I did not succeed.
so i followed then https://github.com/asticode/go-astilectron-demo and nothing.

i see now that
$ go get -u github.com/asticode/go-astilectron-demo/...
download it on .\go\pkg\mod\github.com\asticode\go-astilectron-demo@v0.6.15\ so
$ rm $GOPATH/src/github.com/asticode/go-astilectron-demo/bind.go does nothing
same with the next 2 commands
$ go get -u github.com/asticode/go-astilectron-bundler/... $ go install github.com/asticode/go-astilectron-bundler/astilectron-bundler
first one download to .\go\pkg\mod\github.com\asticode\go-astilectron-bundler@v0.7.11
and second does nothing. and so I did everything wrong.

when i removed bind.go manually
go build . github.com/asticode/go-astilectron-demo .\main.go:45:13: undefined: Asset .\main.go:46:13: undefined: AssetDir .\main.go:90:18: undefined: RestoreAssets

step 3 ..... i tried it with the right path on my config but nothing happens.

added enviroments and output to bundler.json, manually build bundler...
Also, I still can't get the demo to work.
Maybe it is a problem of my configuration or my little knowledge of Go

@asticode
Copy link
Owner

My problems have started when i try to follow this one and I did not succeed.

You're right, this article is pretty old and it may not work with the current version of the project.

$ rm $GOPATH/src/github.com/asticode/go-astilectron-demo/bind.go does nothing

Indeed, as you're not working with a GOPATH you need to remove .\go\pkg\mod\github.com\asticode\go-astilectron-demo@v0.6.15\bind.go instead (which I think you did later)

$ go install github.com/asticode/go-astilectron-bundler/astilectron-bundler does nothing

You need to run go install .\go\pkg\mod\github.com\asticode\go-astilectron-bundler@v0.7.11 instead. It should create a binary names astilectron-bundler in $GOPATH/bin. If not, you need to build it manually by running go build . go-astilectron-bundler

go build . github.com/asticode/go-astilectron-demo .\main.go:45:13: undefined: Asset .\main.go:46:13: undefined: AssetDir .\main.go:90:18: undefined: RestoreAssets

You can't build the demo with go build, only the bundler can build it. You need to use either astilectron-bundler if the previous go install succeeded or the binary you built just previously. If the bundler binary path is /path/to/bundler you need to cd to .\go\pkg\mod\github.com\asticode\go-astilectron-demo@v0.6.15 and run $ /path/to/bundler from here.

Let me know how it goes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants