Skip to content

Error loading workspace in single .mod files repos #2347

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

Closed
morawskiOZ opened this issue Jul 16, 2022 · 4 comments
Closed

Error loading workspace in single .mod files repos #2347

morawskiOZ opened this issue Jul 16, 2022 · 4 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@morawskiOZ
Copy link

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.18.4 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.69.1
      b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a
      x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.34.1
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
    • Checking configured tools....
      GOBIN: undefined
      toolsGopath:
      gopath: /home/pm/go
      GOROOT: /usr/local/go
      PATH: /home/pm/.nvm/versions/node/v18.4.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/local/go/bin:/home/pm/go/bin:/usr/local/go/bin:/home/pm/go/bin
      go: /usr/local/go/bin/go: go version go1.18.4 linux/amd64
      gotests: /home/pm/go/bin/gotests (version: v1.6.0 built with go: go1.18.4)
      gomodifytags: /home/pm/go/bin/gomodifytags (version: v1.16.0 built with go: go1.18.4)
      impl: /home/pm/go/bin/impl (version: v1.1.0 built with go: go1.18.4)
      goplay: /home/pm/go/bin/goplay (version: v1.0.0 built with go: go1.18.4)
      dlv: /home/pm/go/bin/dlv (version: v1.9.0 built with go: go1.18.4)
      golint: /home/pm/go/bin/golint (version: v0.0.0-20210508222113-6edffad5e616 built with go: go1.18.4)
      gopls: /home/pm/go/bin/gopls (version: v0.9.1 built with go: go1.18.4)
      go env
      Workspace Folder (binance-monitor): /home/pm/code/Github/binance-monitor
      GO111MODULE="on"
      GOARCH="amd64"
      GOBIN=""
      GOCACHE="/home/pm/.cache/go-build"
      GOENV="/home/pm/.config/go/env"
      GOEXE=""
      GOEXPERIMENT=""
      GOFLAGS=""
      GOHOSTARCH="amd64"
      GOHOSTOS="linux"
      GOINSECURE=""
      GOMODCACHE="/home/pm/go/pkg/mod"
      GONOPROXY=""
      GONOSUMDB=""
      GOOS="linux"
      GOPATH="/home/pm/go"
      GOPRIVATE=""
      GOPROXY="https://proxy.golang.org,direct"
      GOROOT="/usr/local/go"
      GOSUMDB="sum.golang.org"
      GOTMPDIR=""
      GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
      GOVCS=""
      GOVERSION="go1.18.4"
      GCCGO="gccgo"
      GOAMD64="v1"
      AR="ar"
      CC="gcc"
      CXX="g++"
      CGO_ENABLED="1"
      GOMOD="/home/pm/code/Github/binance-monitor/go.mod"
      GOWORK=""
      CGO_CFLAGS="-g -O2"
      CGO_CPPFLAGS=""
      CGO_CXXFLAGS="-g -O2"
      CGO_FFLAGS="-g -O2"
      CGO_LDFLAGS="-g -O2"
      PKG_CONFIG="pkg-config"
      GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build507315581=/tmp/go-build -gno-record-gcc-switches"

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

  "[go]": {
    "editor.defaultFormatter": "golang.go",
  },
  "go.formatTool": "goimports",
  "go.autocompleteUnimportedPackages": true,
  "go.toolsManagement.autoUpdate": true,
  "go.buildTags": "ignore",
  "go.lintTool": "golint",
  "gopls": {
    "ui.semanticTokens": true,
    "ui.navigation.importShortcut": "Definition"
  },

Describe the bug

After bumping go ver to 1.18.4 all my repos show this error:
Error loading workspace: err: exit status 1: stderr: go build syscall: package using cgo has Go assembly file asm_linux_amd64.s go build runtime: package using cgo has Go assembly file asm.s : packages.Load error

I 've updated every tool and pck I could but still no luck. I don't run multi packages repos so I am suprised I get workspace error.

Steps to reproduce the behavior:

Pretty sure it is only my setup problems (maybe some envs)

Screenshots or recordings

image

@gopherbot gopherbot added this to the Untriaged milestone Jul 16, 2022
@jamalc
Copy link
Contributor

jamalc commented Jul 19, 2022

Does the project compile with the updated go tool chain (i.e. from the workspace root directory, run go clean; go build -tags=ignore ./...)? Also, try reinstalling the go toolchain (make sure the GOROOT of the previous version was completely deleted and reinstall).

@jamalc jamalc added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 19, 2022
@morawskiOZ
Copy link
Author

Does the project compile with the updated go toolchain (i.e. from the workspace root directory, run go clean; go build -tags=ignore ./...)? Also, try reinstalling the go toolchain (make sure the GOROOT of the previous version was completely deleted and reinstall).

@jamalc I reinstalled go again following the official docs, still the same error.

When I try to compile from project root with go clean; go build -tags=ignore ./... I am getting multiple imports x import cycle not allowed for all packages (strange)
image

If I run go build inside my cmd folder, it builds binary just fine.

@hyangah
Copy link
Contributor

hyangah commented Jul 20, 2022

@morawskiOZ Do you encounter the problem if you remove the "go.buildTags" setting? I understand why you want it but it seems like gopls is currently not capable of handling the conflicts caused by adding ignore-ed files in the runtime, syscall and many other packages. I am not quite sure about the original issue (syscall: package using cgo has Go assembly file asm_linux_amd64.s error message but it's possible that that is a side-effect of including files that are supposed to be ignored.

There are multiple open issues in gopls related to better build tag supports

@morawskiOZ
Copy link
Author

morawskiOZ commented Jul 21, 2022

@morawskiOZ Do you encounter the problem if you remove the "go.buildTags" setting? I understand why you want it but it seems like gopls is currently not capable of handling the conflicts caused by adding ignore-ed files in the runtime, syscall and many other packages. I am not quite sure about the original issue (syscall: package using cgo has Go assembly file asm_linux_amd64.s error message but it's possible that that is a side-effect of including files that are supposed to be ignored.

There are multiple open issues in gopls related to better build tag supports

Yes, that was it. Thank you @hyangah and @jamalc for all the help. Super weird that this showed up only after I bumped Go and all the tools to the newest version. Anyway, as there are already gopls related issues open I am closing this one. I hope this issue will help some poor soul in the future with the same problem ;)

@golang golang locked and limited conversation to collaborators Jul 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants