Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package "context" without types was imported #4060

Open
deexem opened this issue Feb 11, 2025 · 10 comments · May be fixed by #4064
Open

package "context" without types was imported #4060

deexem opened this issue Feb 11, 2025 · 10 comments · May be fixed by #4064
Labels
Bug Something isn't working

Comments

@deexem
Copy link

deexem commented Feb 11, 2025

Description

Hi,

I can't run wails dev (or wails build)

I get: internal error: package "context" without types was imported from .PROJECTNAME

go version: go version go1.24.0 windows/amd64
wails cli: Wails CLI v2.9.2

A similar thing happens with a fresh install under WSL

To Reproduce

wails dev

Expected behaviour

Wails dev starts the app

Screenshots

No response

Attempted Fixes

Tried in WSL under Ubuntu
Downgraded golang to 1.23.6
Downgraded Wails CLI to 2.9.0

System Details

# Wails
Version | v2.9.2

# System
┌─────────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Windows 10 Pro                                                                   |
| Version      | 2009 (Build: 26100)                                                              |
| ID           | 24H2                                                                             |
| Go Version   | go1.24.0                                                                         |
| Platform     | windows                                                                          |
| Architecture | amd64                                                                            |
| CPU          | AMD Ryzen 9 7950X3D 16-Core Processor                                            |
| GPU 1        | NVIDIA GeForce RTX 4090 (NVIDIA) - Driver: 32.0.15.6614                          |
| GPU 2        | AMD Radeon(TM) Graphics (Advanced Micro Devices, Inc.) - Driver: 32.0.11027.2001 |
| Memory       | 64GB                                                                             |
└─────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version        |
| WebView2   | N/A          | Installed | 132.0.2957.140 |
| Nodejs     | N/A          | Installed | 20.10.0        |
| npm        | N/A          | Installed | 10.2.3         |
| *upx       | N/A          | Available |                |
| *nsis      | N/A          | Available |                |
└─────────────── * - Optional Dependency ────────────────┘

# Diagnosis
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/
  - nsis : More info at https://wails.io/docs/guides/windows-installer/

 SUCCESS  Your system is ready for Wails development!

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:

Additional context

No response

@deexem deexem added the Bug Something isn't working label Feb 11, 2025
@kettek
Copy link

kettek commented Feb 11, 2025

Same issue with 1.24.0, but with "encoding/json" instead.

@kettek
Copy link

kettek commented Feb 11, 2025

Updating golang.org/x/tools in wails itself might fix this, see BurntSushi/go-sumtype#17 (comment)

@kettek
Copy link

kettek commented Feb 11, 2025

I can confirm, updating golang.org/x/tools/ to v0.30.0 for cmd/wails fixes the problem.

In the interim, this can be done by cloning the wails repo, entering the v2 dir, issuing go get golang.org/x/tools, go mod tidy, go build ./cmd/wails, and then copying the wails binary to your go bin directory.

@learncodingforweb
Copy link

learncodingforweb commented Feb 12, 2025

I am also facing same issue. Steps i followed are

wails init -n myproject -t react-ts
Wails CLI v2.9.2


# Initialising Project 'myproject'
go: downloading github.com/matryer/is v1.4.0
go: downloading github.com/leaanthony/u v1.1.0
go: downloading github.com/stretchr/testify v1.8.4
go: downloading github.com/labstack/echo/v4 v4.10.2
go: downloading github.com/leaanthony/go-ansi-parser v1.6.0
go: downloading github.com/wailsapp/go-webview2 v1.0.16
go: downloading github.com/wailsapp/mimetype v1.4.1
go: downloading github.com/tkrajina/go-reflector v0.5.6
go: downloading github.com/godbus/dbus/v5 v5.1.0
go: downloading github.com/bep/debounce v1.2.1
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e
go: downloading github.com/go-ole/go-ole v1.2.6
go: downloading github.com/valyala/fasttemplate v1.2.2
go: downloading github.com/google/uuid v1.3.0
go: downloading github.com/valyala/bytebufferpool v1.0.0
Project Name      | myproject                 
Project Directory | /home/camera/dev/myproject
Template          | React + Vite (Typescript) 
Template Source   | https://wails.io          

Initialised project 'myproject' in 9.843s.

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

Running wails in development mode

wails dev
Wails CLI v2.9.2

Executing: go mod tidy
2025/02/12 11:08:04 internal error: package "context" without types was imported from "myproject"

OS Information

cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
uname -a
Linux dfmd 6.8.0-52-generic #53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Wails Details

wails doctor

                                
          Wails Doctor          
                                

                                                                                                                                                      
# Wails
Version         | v2.9.2
Package Manager | apt   

# System
┌───────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                                                 |
| Version      | 22.04                                                                  |
| ID           | ubuntu                                                                 |
| Go Version   | go1.24.0                                                               |
| Platform     | linux                                                                  |
| Architecture | amd64                                                                  |
| CPU          | Intel(R) Core(TM) i3-8100T CPU @ 3.10GHz                               |
| GPU          | CoffeeLake-S GT2 [UHD Graphics 630] (Intel Corporation) - Driver: i915 |
| Memory       | 8GB                                                                    |
└───────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Installed | 26.1.3-0ubuntu1~22.04.1 |
| gcc        | build-essential       | Installed | 12.9ubuntu3             |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.33-1ubuntu2.2      |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.46.5-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.9.2                  |
| *nsis      | nsis                  | Installed | v3.08-2                 |
| pkg-config | pkg-config            | Installed | 0.29.2                  |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

# Diagnosis
 SUCCESS  Your system is ready for Wails development!

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

GO Details

go version
go version go1.24.0 linux/amd64

@OlongCrab
Copy link

I can confirm, updating golang.org/x/tools/ to v0.30.0 for cmd/wails fixes the problem.

In the interim, this can be done by cloning the wails repo, entering the v2 dir, issuing go get golang.org/x/tools, go mod tidy, go build ./cmd/wails, and then copying the wails binary to your go bin directory.

could you show the full solution

@symball
Copy link

symball commented Feb 12, 2025

Confirming what Kettek suggests as a fix.

@OlongCrab specific terminal commands are as follows

git clone [email protected]:wailsapp/wails.git
cd wails/v2
go get -u golang.org/x/tools
go mod tidy
go build -o wails ./cmd/wails

This will create the artefact which you then move to your GOBIN path

@VdanielVPL VdanielVPL linked a pull request Feb 12, 2025 that will close this issue
15 tasks
@Snider
Copy link
Contributor

Snider commented Feb 12, 2025

GHA is down https://github.com/dAppServer/wails-build-action/actions/runs/13289752009

I can't adjust people's code like this, so we need a fix as soon as possible @leaanthony @stffabi .

@leaanthony
Copy link
Member

leaanthony commented Feb 12, 2025

I'm getting suspicious of Go's backwards compatibility claim 😅

For now, we don't support 1.24

@leaanthony
Copy link
Member

go install github.com/wailsapp/wails/v2/cmd/[email protected]
For some reason, @latest isn't working for me. Must be going off commit dates or something.
I'll release v2.10 over the weekend.

@Snider
Copy link
Contributor

Snider commented Feb 12, 2025

I'm getting suspicious of Go's backwards compatibility claim 😅

For now, we don't support 1.24

The GHA default is now 1.23, not ^1.20, people can and should set their own versions anyways :)

@namchivas2k namchivas2k marked this as a duplicate of #4069 Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants