Search code examples
gouser-interfaceinstallationfyne

no required module provides package fyne.io/fyne/app: go.mod file not found in current directory or any parent directory on intel mac


I'm getting this error when trying 'go build'

no required module provides package fyne.io/fyne/app: go.mod file not found in current directory or any parent directory; see 'go help modules' test.go:5:5: no required module provides package fyne.io/fyne/widget: go.mod file not found in current directory or any parent directory; see 'go help modules'

But i'm installed fyne.io/fyne and i don't know why i have this mistake. I tried to reinstall Go but it's didn't help

enter image description here


Solution

  • Since Go 1.16 modules are required so you need to run go mod init <project name>. Note also that for Fyne you should use the v2 imports now, which are ”fyne.io/fyne/v2”. And you should install the fyne tool from fyne.io/fyne/v2/cmd/fyne.