fyne-io / developer.fyne.io

Fyne developer documentation website
https://developer.fyne.io
27 stars 72 forks source link

Run the demo gives Go error #109

Closed stephanwesten closed 1 year ago

stephanwesten commented 1 year ago

Checklist

Describe the bug

I followed the command described on https://developer.fyne.io/started/#run-the-demo

Since the text says "If you want to see the Fyne toolkit in action before you start to code your own application", I (wrongly) assumed I did not have to do / install anything first.

This is the output from my computer executed in folder 'temp':

➜ temp go run fyne.io/fyne/v2/cmd/fyne_demo no required module provides package fyne.io/fyne/v2/cmd/fyne_demo: go.mod file not found in current directory or any parent directory; see 'go help modules' ➜ temp go version go version go1.18 darwin/arm64

Later on I realised that the author meant that I had to do the steps described in Downloading section first. You need to take the phrase 'to code' literally.

However if you execute go mod tidy - it will remove the required fyne dependency since there is no Go file referencing it. If you skip go mod tidy, so the dependency is there, you are also out of luck since there is no go.sum file.

So after repeating the steps in the Download section, I got the following error message:

➜ temp go run fyne.io/fyne/v2/cmd/fyne_demo no required module provides package fyne.io/fyne/v2/cmd/fyne_demo; to add it: go get fyne.io/fyne/v2/cmd/fyne_demo

If you execute above go get command, it works.

A solution is to move the Installing section up, as first part of Running the demo.

How to reproduce

see above

Screenshots

No response

Example code

n/a

Fyne version

latest

Go compiler version

1.18

Operating system

macOS

Operating system version

12.2.1

Additional Information

No response

andydotxyz commented 1 year ago

It seems that from Go 1.18 "go run" does not work for 3rd party apps :(.

The following might be the replacement:

go install fyne.io/fyne/v2/cmd/fyne_demo@latest
fyne_demo
andydotxyz commented 1 year ago

Moving to the documentation website repo

Bluebugs commented 1 year ago

go run fyne.io/fyne/v2/cmd/fyne_demo@latest should still work.

hlubek commented 1 year ago

See #111 for a simple fix regarding go mod tidy not working. You can get all packages recursively so the demo can be run with go run fyne.io/fyne/v2/cmd/fyne_demo afterwards.