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

github.com/go-jose/go-jose/v4 is not in your go.mod file (go mod tidy) #3675

Open
khanakia opened this issue Feb 1, 2025 · 4 comments
Open
Assignees

Comments

@khanakia
Copy link

khanakia commented Feb 1, 2025

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.23.2 darwin/arm64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
Build info
----------
golang.org/x/tools/gopls v0.17.1
    golang.org/x/tools/[email protected] h1:Mt/DSfnnSe3dyf6MH/dZZ0iww+viHNhAFc4rEYDiOAw=
    github.com/BurntSushi/[email protected] h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
    github.com/google/[email protected] h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
    golang.org/x/exp/[email protected] h1:1P7xPZEwZMoBoz0Yze5Nx2/4pxj6nw9ZqHWXqP0iRgQ=
    golang.org/x/[email protected] h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
    golang.org/x/[email protected] h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
    golang.org/x/[email protected] h1:TCDqnvbBsFapViksHcHySl/sW4+rTGNIAoJJesHRuMM=
    golang.org/x/[email protected] h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
    golang.org/x/[email protected] h1:kgwdasJRsdDWYgWcEgMF424DiXwwXHSb3V8xVTi//i8=
    golang.org/x/[email protected] h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=
    honnef.co/go/[email protected] h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I=
    mvdan.cc/[email protected] h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
    mvdan.cc/xurls/[email protected] h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
go: go1.23.2
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
1.96.4
cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba
arm64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.44.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
# Tools Configuration


## Environment

GOBIN: undefined
toolsGopath: 
gopath: /Volumes/D/khanakia/go
GOROOT: /usr/local/go
PATH: /Volumes/D/khanakia/.bun/bin:/Volumes/D/khanakia/.yarn/bin:/Volumes/D/khanakia/.config/yarn/global/node_modules/.bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/[email protected]/sbin:/opt/homebrew/opt/[email protected]/bin:/Volumes/D/khanakia/.deno/bin:/Volumes/D/khanakia/Library/pnpm:/Volumes/D/khanakia/.nvm/versions/node/v22.12.0/bin:/Volumes/D/www/flutter/flutter/bin:/Volumes/D/khanakia/Library/Android/sdk/platform-tools:/Volumes/D/khanakia/Library/Android/sdk/platform-tools/bin:/Volumes/D/khanakia/Library/Android/sdk/tools/bin:/Volumes/D/khanakia/Library/Android/sdk/tools:/Volumes/D/khanakia/.composer/vendor/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/go/bin:/Volumes/D/khanakia/.cargo/bin:/Volumes/D/khanakia/go/bin:/opt/homebrew/lib/ruby/gems/3.3.0/bin:/usr/local/go/bin:/Applications/Postgres.app/Contents/Versions/17/bin:/Volumes/D/khanakia/.pub-cache/bin:/Volumes/D/khanakia/.local/bin:/Volumes/D/i2/bin/nvim-macos/bin:/Volumes/D/khanakia/.cache/lm-studio/bin

## Tools

	go:	/usr/local/go/bin/go: go version go1.23.2 darwin/arm64

	gopls:	/Volumes/D/khanakia/go/bin/gopls	(version: v0.17.1 built with go: go1.23.2)
	gotests:	/Volumes/D/khanakia/go/bin/gotests	(version: v1.6.0 built with go: go1.23.1)
	gomodifytags:	/Volumes/D/khanakia/go/bin/gomodifytags	(version: v1.16.0 built with go: go1.23.1)
	impl:	/Volumes/D/khanakia/go/bin/impl	(version: v1.1.0 built with go: go1.23.1)
	goplay:	/Volumes/D/khanakia/go/bin/goplay	(version: v1.0.0 built with go: go1.23.1)
	dlv:	/Volumes/D/khanakia/go/bin/dlv	(version: v1.23.0 built with go: go1.23.1)
	staticcheck:	/Volumes/D/khanakia/go/bin/staticcheck	(version: v0.5.1 built with go: go1.23.1)

## Go env

Workspace Folder (saasfly_api): /Volumes/D/www/projects/khanakia/saasfly/saasfly_api

	GO111MODULE='on'
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Volumes/D/khanakia/Library/Caches/go-build'
	GOENV='/Volumes/D/khanakia/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Volumes/D/khanakia/go/pkg/mod'
	GONOPROXY='github.com/theuxm'
	GONOSUMDB='github.com/theuxm'
	GOOS='darwin'
	GOPATH='/Volumes/D/khanakia/go'
	GOPRIVATE='github.com/theuxm'
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/usr/local/go'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.23.2'
	GODEBUG=''
	GOTELEMETRY='local'
	GOTELEMETRYDIR='/Volumes/D/khanakia/Library/Application Support/go/telemetry'
	GCCGO='gccgo'
	GOARM64='v8.0'
	AR='ar'
	CC='clang'
	CXX='clang++'
	CGO_ENABLED='1'
	GOMOD='/dev/null'
	GOWORK='/Volumes/D/www/projects/khanakia/saasfly/saasfly_api/go.work'
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	PKG_CONFIG='pkg-config'
	GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/sk/k6vkn27d2xbcxcj1ll6dvwjw0000gn/T/go-build1905123601=/tmp/go-build -gno-record-gcc-switches -fno-common'
	

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.toolsEnvVars": {
    "GO111MODULE": "on"
  },

Describe the bug

I am getting this error github.com/go-jose/go-jose/v4 is not in your go.mod file (go mod tidy) and when I try to run these commands

go clean -modcache
go clean -cache

then issue seems to be fixed for a while and then it comes again and I tried everything

  • I am using go workspace
  • I ran into the module directory cd saas && go mo tidy and then cd .. && go work vendor but still same issue

Steps to reproduce the behavior:

I am using go workspace and I have a module exists in go.mod file

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

Check VIDEO Here: https://www.youtube.com/watch?v=ULb7VB1ANrw

Image

Image

@gopherbot gopherbot added this to the Untriaged milestone Feb 1, 2025
@findleyr
Copy link
Member

findleyr commented Feb 7, 2025

Hi @khanakia, if you're able to go back and forth a bit, I can help you track this down.

When it happens, can you do the following?

  • Run Go: Start language server's maintainer interface
  • Click on Session 1
  • Share the summary of Views that you see.
  • Click on the overlay for go.mod in question. Does it contain the require?

Are you saying that after you fix these from the command line, they come back, randomly?

@khanakia
Copy link
Author

khanakia commented Feb 7, 2025

It just happens random and also it happened today so what I did is

go clean -modcache
go clean -cache
go work vendor

and then error is gone

I will have to wait for it to happen again and then I will follow the above steps to debug as you suggested

@khanakia
Copy link
Author

khanakia commented Feb 10, 2025

@findleyr Got the error again and i followed the steps and below is the output from the language server's maintainer interface

Image

I can see the module listed in go.mod file

github.com/aws/aws-sdk-go-v2/config v1.29.6
Main Info Memory Profiling Metrics RPC Trace Analysis
Session 1
From: Cache 1
Views
ID: 1
Type: GoWork
Root: file:///myproject
Folder: myproject:file:///
Overlays
file:///myproject/saas/cmd/test/main.go
file:///myproject/vendor/entgo.io/contrib/entgql/annotation.go
file:///myproject/gqlsa/main.go
file:///myproject/saas/pkg/awsfn/awsfn.go
file:///myproject/saas/pkg/medialibrary/medialibrary.go
file:///myproject/vendor/entgo.io/ent/schema/field/field.go
file:///myproject/saas/go.mod
file:///myproject/gqlsa/internal/handlers/handlers.go
file:///myproject/saas/schema/storage_disk.go

go.mod file

Here is the go.mod file from the Interfance
Overlay 77fc2ed2eb50dc4cf8f480323486e0f9bd9b997854c4cd274fcb9fe899c1ae64
URI: file:///myproject/saas/go.mod
Identifier: 77fc2ed2eb50dc4cf8f480323486e0f9bd9b997854c4cd274fcb9fe899c1ae64
Version: 1
Kind: go.mod
Contents
module saas

go 1.23.2

replace (
	configmgr => ../configmgr
	github.com/ubgo/filepathutil => ../filepathutil
	gql => ../gql
	gqlsa => ../gqlsa
	lace => ../lace
)

require (
	configmgr v0.0.0-00010101000000-000000000000
	entgo.io/contrib v0.6.0
	entgo.io/ent v0.14.2-0.20241231052425-fc57ede2fe0d
	github.com/99designs/gqlgen v0.17.62
	github.com/cohesivestack/valgo v0.4.1
	github.com/fatih/color v1.18.0
	github.com/gin-gonic/gin v1.10.0
	github.com/golang-jwt/jwt v3.2.2+incompatible
	github.com/google/uuid v1.6.0
	github.com/gosimple/slug v1.15.0
	github.com/hashicorp/go-multierror v1.1.1
	github.com/invopop/jsonschema v0.13.0
	github.com/kkdai/twitter v0.1.0
	github.com/lib/pq v1.10.9
	github.com/matoous/go-nanoid/v2 v2.1.0
	github.com/nats-io/nats.go v1.38.0
	github.com/spf13/cast v1.7.1
	github.com/spf13/cobra v1.8.1
	github.com/ubgo/goutil v0.1.3
	github.com/uptrace/bun v1.2.7
	github.com/uptrace/bun/dialect/pgdialect v1.2.7
	github.com/vektah/gqlparser/v2 v2.5.21
	github.com/xhit/go-simple-mail/v2 v2.16.0
	golang.org/x/crypto v0.31.0
	golang.org/x/oauth2 v0.24.0
	gql v0.0.0-00010101000000-000000000000
	gqlsa v0.0.0-00010101000000-000000000000
	lace v0.0.0-00010101000000-000000000000
)

require (
	github.com/aws/aws-sdk-go-v2 v1.36.1
	github.com/aws/aws-sdk-go-v2/config v1.29.6
	github.com/aws/aws-sdk-go-v2/credentials v1.17.59
	github.com/aws/aws-sdk-go-v2/service/s3 v1.76.0
	github.com/go-jose/go-jose/v4 v4.0.4
	github.com/go-openapi/inflect v0.21.0
	github.com/mat/besticon v3.12.0+incompatible
	github.com/ubgo/filepathutil v0.0.0-00010101000000-000000000000
	golang.org/x/image v0.23.0
)

require (
	ariga.io/atlas v0.29.1 // indirect
	cloud.google.com/go/compute/metadata v0.6.0 // indirect
	github.com/agext/levenshtein v1.2.3 // indirect
	github.com/agnivade/levenshtein v1.2.0 // indirect
	github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
	github.com/apple/pkl-go v0.9.0 // indirect
	github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.8 // indirect
	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.28 // indirect
	github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.32 // indirect
	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.32 // indirect
	github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 // indirect
	github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.32 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.2 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.5.6 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.13 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.13 // indirect
	github.com/aws/aws-sdk-go-v2/service/sso v1.24.15 // indirect
	github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.14 // indirect
	github.com/aws/aws-sdk-go-v2/service/sts v1.33.14 // indirect
	github.com/aws/smithy-go v1.22.2 // indirect
	github.com/bahlo/generic-list-go v0.2.0 // indirect
	github.com/bmatcuk/doublestar v1.3.4 // indirect
	github.com/buger/jsonparser v1.1.1 // indirect
	github.com/bytedance/sonic v1.12.6 // indirect
	github.com/bytedance/sonic/loader v0.2.1 // indirect
	github.com/cloudwego/base64x v0.1.4 // indirect
	github.com/cloudwego/iasm v0.2.0 // indirect
	github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
	github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
	github.com/gabriel-vasile/mimetype v1.4.8 // indirect
	github.com/getsentry/sentry-go v0.31.1 // indirect
	github.com/gin-contrib/sse v1.0.0 // indirect
	github.com/go-playground/locales v0.14.1 // indirect
	github.com/go-playground/universal-translator v0.18.1 // indirect
	github.com/go-playground/validator/v10 v10.23.0 // indirect
	github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
	github.com/goccy/go-json v0.10.4 // indirect
	github.com/google/go-cmp v0.6.0 // indirect
	github.com/gorilla/websocket v1.5.3 // indirect
	github.com/gosimple/unidecode v1.0.1 // indirect
	github.com/hashicorp/errwrap v1.1.0 // indirect
	github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
	github.com/hashicorp/hcl/v2 v2.23.0 // indirect
	github.com/inconshreveable/mousetrap v1.1.0 // indirect
	github.com/jackc/pgpassfile v1.0.0 // indirect
	github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
	github.com/jackc/pgx/v5 v5.7.2 // indirect
	github.com/jackc/puddle/v2 v2.2.2 // indirect
	github.com/jinzhu/inflection v1.0.0 // indirect
	github.com/json-iterator/go v1.1.12 // indirect
	github.com/klauspost/compress v1.17.11 // indirect
	github.com/klauspost/cpuid/v2 v2.2.9 // indirect
	github.com/leodido/go-urn v1.4.0 // indirect
	github.com/mailru/easyjson v0.9.0 // indirect
	github.com/mattn/go-colorable v0.1.13 // indirect
	github.com/mattn/go-isatty v0.0.20 // indirect
	github.com/mitchellh/go-wordwrap v1.0.1 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.2 // indirect
	github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 // indirect
	github.com/nats-io/nkeys v0.4.9 // indirect
	github.com/nats-io/nuid v1.0.1 // indirect
	github.com/pelletier/go-toml/v2 v2.2.3 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
	github.com/puzpuzpuz/xsync/v3 v3.4.0 // indirect
	github.com/russross/blackfriday/v2 v2.1.0 // indirect
	github.com/sosodev/duration v1.3.1 // indirect
	github.com/spf13/pflag v1.0.5 // indirect
	github.com/stretchr/testify v1.10.0 // indirect
	github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
	github.com/toorop/go-dkim v0.0.0-20240103092955-90b7d1423f92 // indirect
	github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
	github.com/ugorji/go/codec v1.2.12 // indirect
	github.com/urfave/cli/v2 v2.27.5 // indirect
	github.com/valyala/bytebufferpool v1.0.0 // indirect
	github.com/valyala/fasttemplate v1.2.2 // indirect
	github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
	github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
	github.com/wk8/go-ordered-map/v2 v2.1.9-0.20240816141633-0a40785b4f41 // indirect
	github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
	github.com/zclconf/go-cty v1.16.0 // indirect
	go.uber.org/multierr v1.11.0 // indirect
	go.uber.org/zap v1.27.0 // indirect
	golang.org/x/arch v0.12.0 // indirect
	golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 // indirect
	golang.org/x/mod v0.22.0 // indirect
	golang.org/x/net v0.33.0 // indirect
	golang.org/x/sync v0.10.0 // indirect
	golang.org/x/sys v0.28.0 // indirect
	golang.org/x/text v0.21.0 // indirect
	golang.org/x/tools v0.28.0 // indirect
	google.golang.org/protobuf v1.36.1 // indirect
	gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
)

@melkus
Copy link

melkus commented Feb 12, 2025

I have similar issue with my workspace. It appeared maybe half an year ago, but now it is permanent.
The only workaround that works for me is to open a single project instead of workspace.

My workspace has shared projects with replace statements in project go.mod like this:
replace bitbucket.org/myAccount/myLibrary => ../myLibrary

I am not ready to share my code, but maybe I will return later with more details if I can create a snippet to reproduce.

@jba jba modified the milestones: Untriaged, vscode-go/backlog Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants