fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
16.01k stars 1.45k forks source link

Syntax checking/diagnostics doesn't seems to work when using go version with format 1.X.X in go.mod file #3677

Open albdewilde opened 2 months ago

albdewilde commented 2 months ago

What did you do? (required: The issue will be closed when not provided)

I've put the go version with the format 1.22.4 (instead of 1.22) in my go.mod file.

What did you expect to happen?

I expect to still get syntax checking and highlight after doing so. Here is what I want:

2024-08-07-155720_764x306_scrot

What happened instead?

The highlight is not present:

2024-08-07-155548_758x309_scrot

Configuration (MUST fill this out):

vim-go version:

I'm using the latest master version (commit a64d097a1af1772c24d13f34529b9be2a34b7721)

vimrc you used to reproduce:

vimrc ```vim " Turn off filetype detection (to avoid errors) filetype off " Turn on color syntax if has("syntax") syntax on endif " Load plugins, indent, and filetype of the opened file if has("autocmd") filetype plugin indent on endif ```

Vim version (first three lines from :version):

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 03 2024 02:37:51) Included patches: 1-579, 1969, 580-1848, 4975, 5016, 5023, 5072, 2068, 1849-1854, 1857, 1855-1857, 1331, 1858, 1858-1859, 1873, 1860-1969, 1992, 1970-1992, 2010, 1993-2068, 2106, 2069-2106, 2108, 2107-2109, 2109-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919, 213, 1840, 1846-1847, 2110-2112, 2121 Modified by team+vim@tracker.debian.org

Go version (go version):

go version go1.22.6 linux/amd64

Go environment

go env Output:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/alban/.cache/go-build'
GOENV='/home/alban/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/alban/prg/go/pkg/mod'
GONOPROXY='github.com/figarocms'
GONOSUMDB='github.com/figarocms'
GOOS='linux'
GOPATH='/home/alban/prg/go'
GOPRIVATE='github.com/figarocms'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.6'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build536275403=/tmp/go-build -gno-record-gcc-switches'

gopls version

gopls version Output:

golang.org/x/tools/gopls v0.15.3

vim-go configuration:

vim-go configuration
g:go_loaded_gosnippets = 1
g:go_jump_to_error = 1
g:go_loaded_install = 1

filetype detection configuration:

filetype detection
filetype detection:ON  plugin:ON  indent:ON
bhcleek commented 2 months ago

Note that in general your two examples show that the syntax highlighting provided by vim-go is working in general. The problem you're experiencing seems to be related to diagnostics by gopls to help identify errors and warnings that it provides.

What version of Go did you build gopls with? If you're not certain, executing :GoUpdateBinaries gopls will ensure it's built with the version of Go you have installed. Can you do that and then see if the problem you're seeing persists?

albdewilde commented 2 months ago

I've changed the title to replace Syntax checking/highlight by Syntax checking/diagnostics

Here is the gopls version I had the issue with:

$ gopls version
golang.org/x/tools/gopls v0.15.3

and my Go version is:

$ go version
go version go1.22.6 linux/amd64

Running :GoUpdateBinaries gopls have updated the tool to the v0.16.1. I also have run :GoUpdateBinaries to update all tools. But I still have the same issue.

I've started vim with the -V9 option to get some logs. Here is what I got that seems to be related to gopls:

vim-go: initializing gopls
chdir(/home/alban/.vim/pack/plugin/start/vim-go/autoload/go)
fchdir() to previous dir
line 18: sourcing "/home/alban/.vim/pack/plugin/start/vim-go/autoload/go/statusline.vim"
finished sourcing /home/alban/.vim/pack/plugin/start/vim-go/autoload/go/statusline.vim
continuing in 12
Executing BufRead Autocommands for "*"
autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | runtime! scripts.vim | endif

Executing BufRead Autocommands for "*"
autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat    && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'^I|| getline(4) =~ '^#' || getline(5) =~ '^#') |   setf FALLBACK conf | endif

Executing BufRead Autocommands for "*.go"
autocommand call s:gofiletype_pre()

autocommand call s:gofiletype_post()

Executing BufRead Autocommands for "*.go"
autocommand setfiletype go

Executing BufEnter Autocommands for "*"
autocommand sil call s:LocalBrowse(expand("<amatch>"))

Executing BufEnter Autocommands for "<buffer=1>"
autocommand call go#auto#update_autocmd()

chdir(/home/alban/.vim/pack/plugin/start/vim-go/autoload/go)
fchdir() to previous dir
line 0: sourcing "/home/alban/.vim/pack/plugin/start/vim-go/autoload/go/auto.vim"
finished sourcing /home/alban/.vim/pack/plugin/start/vim-go/autoload/go/auto.vim
continuing in BufEnter Autocommands for "<buffer=1>"
Executing VimEnter Autocommands for "*"
autocommand sil call s:VimEnter(expand("<amatch>"))

chdir(domain/batch/alerts/fi)
fchdir() to previous dir
chdir(/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch)
Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

vim-go: initialized gopls

It seems there is no error from gopls here but it seems there is still no diagnostics when i open some Go files.


I'm new to debugging vim plugins. So, if there is some option or logs files I can start vim with or send to facilitate discovering what is going on, please, be pleased to ask for more.


As @bhcleek seems to say it may be an issue with the gopls tool. Should I open an issue there or is this too early to be sure the problem is from gopls ?

bhcleek commented 2 months ago

I don't think it's actually an issue with gopls; I suspect it's an issue with your code that gopls identifies for you.

Can you:

  1. add let g:go_debug=['lsp'] to your vimrc
  2. duplicate the correct highlighting
  3. save the contents of the __GOLSP_LOG__ window
  4. close vim
  5. update your go.mod file
  6. duplicate the actions you took to show the correct highlighting (this time it shouldn't show the highlighting IIUC)
  7. save the contents of the __GOLSP_LOG__` window

Provide the contents of the two __GOLSP_LOG__ windows here?

albdewilde commented 2 months ago

It seems you are right, gopls find an undefined method in the logs (I've added a method plop that doesn't exist).

Here is the logs I have when I use the 1.X format in the go mod and it highlight the undefined method:

===== sent =====
Content-Length: 773

{"method":"initialize","jsonrpc":"2.0","id":1,"params":{"rootUri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","capabilities":{"workspace":{"workspaceFolders":true,"workspaceEdit":{"documentChanges":true},"configuration":true,"didChangeConfiguration":{"dynamicRegistration":true}},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["source.organizeImports","refactor.rewrite","refactor.extract"]}}},"completion":{"completionItem":{"snippetSupport":false}},"hover":{"contentFormat":["plaintext"]}}},"clientInfo":{"name":"vim-go"},"processId":11968,"workspaceFolders":[{"uri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","name":"/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch"}]}}
===== received =====
Content-Length: 261

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2024/08/14 10:14:32 Handshake session update\n\tupdate_session=2\n\tdebug_address=\"127.0.0.1:35629\"\n\tlogfile=\"\"\n\tserver=\"1\"\n\tgopls_path=\"/home/alban/prg/go/bin/gopls\"\n"}}
===== received =====
Content-Length: 4526

{"jsonrpc":"2.0","result":{"capabilities":{"textDocumentSync":{"change":2,"openClose":true,"save":{}},"completionProvider":{"triggerCharacters":["."]},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.inline","refactor.rewrite","source.assembly","source.doc","source.fixAll","source.freesymbols","source.organizeImports"],"resolveProvider":true},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"renameProvider":true,"foldingRangeProvider":true,"selectionRangeProvider":true,"executeCommandProvider":{"commands":["gopls.add_dependency","gopls.add_import","gopls.add_telemetry_counters","gopls.apply_fix","gopls.assembly","gopls.change_signature","gopls.check_upgrades","gopls.diagnose_files","gopls.doc","gopls.edit_go_directive","gopls.fetch_vulncheck_result","gopls.free_symbols","gopls.gc_details","gopls.generate","gopls.go_get_package","gopls.list_imports","gopls.list_known_packages","gopls.maybe_prompt_for_telemetry","gopls.mem_stats","gopls.regenerate_cgo","gopls.remove_dependency","gopls.reset_go_mod_diagnostics","gopls.run_go_work_command","gopls.run_govulncheck","gopls.run_tests","gopls.scan_imports","gopls.start_debugging","gopls.start_profile","gopls.stop_profile","gopls.test","gopls.tidy","gopls.toggle_gc_details","gopls.update_go_sum","gopls.upgrade_dependency","gopls.vendor","gopls.views","gopls.workspace_stats"]},"callHierarchyProvider":true,"semanticTokensProvider":{"full":true,"legend":{"tokenModifiers":[],"tokenTypes":[]},"range":true},"inlayHintProvider":{},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"gopls","version":"{\"GoVersion\":\"go1.22.6\",\"Path\":\"golang.org/x/tools/gopls\",\"Main\":{\"Path\":\"golang.org/x/tools/gopls\",\"Version\":\"v0.16.1\",\"Sum\":\"h1:1hO/dCeUvjEYx3V0rVvCtOkwnpEpqS29paE+Jw4dcAc=\",\"Replace\":null},\"Deps\":[{\"Path\":\"github.com/BurntSushi/toml\",\"Version\":\"v1.2.1\",\"Sum\":\"h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=\",\"Replace\":null},{\"Path\":\"github.com/google/go-cmp\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=\",\"Replace\":null},{\"Path\":\"golang.org/x/exp/typeparams\",\"Version\":\"v0.0.0-20221212164502-fae10dda9338\",\"Sum\":\"h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=\",\"Replace\":null},{\"Path\":\"golang.org/x/mod\",\"Version\":\"v0.18.0\",\"Sum\":\"h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=\",\"Replace\":null},{\"Path\":\"golang.org/x/sync\",\"Version\":\"v0.7.0\",\"Sum\":\"h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=\",\"Replace\":null},{\"Path\":\"golang.org/x/telemetry\",\"Version\":\"v0.0.0-20240607193123-221703e18637\",\"Sum\":\"h1:3Wt8mZlbFwG8llny+t18kh7AXxyWePFycXMuVdHxnyM=\",\"Replace\":null},{\"Path\":\"golang.org/x/text\",\"Version\":\"v0.16.0\",\"Sum\":\"h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=\",\"Replace\":null},{\"Path\":\"golang.org/x/tools\",\"Version\":\"v0.22.1-0.20240628205440-9c895dd76b34\",\"Sum\":\"h1:Kd+Z5Pm6uwYx3T2KEkeHMHUMZxDPb/q6b1m+zEcy62c=\",\"Replace\":null},{\"Path\":\"golang.org/x/vuln\",\"Version\":\"v1.0.4\",\"Sum\":\"h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=\",\"Replace\":null},{\"Path\":\"honnef.co/go/tools\",\"Version\":\"v0.4.7\",\"Sum\":\"h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs=\",\"Replace\":null},{\"Path\":\"mvdan.cc/gofumpt\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=\",\"Replace\":null},{\"Path\":\"mvdan.cc/xurls/v2\",\"Version\":\"v2.5.0\",\"Sum\":\"h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=\",\"Replace\":null}],\"Settings\":[{\"Key\":\"-buildmode\",\"Value\":\"exe\"},{\"Key\":\"-compiler\",\"Value\":\"gc\"},{\"Key\":\"DefaultGODEBUG\",\"Value\":\"httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1\"},{\"Key\":\"CGO_ENABLED\",\"Value\":\"1\"},{\"Key\":\"CGO_CFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CPPFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CXXFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_LDFLAGS\",\"Value\":\"\"},{\"Key\":\"GOARCH\",\"Value\":\"amd64\"},{\"Key\":\"GOOS\",\"Value\":\"linux\"},{\"Key\":\"GOAMD64\",\"Value\":\"v1\"}],\"Version\":\"v0.16.1\"}"}},"id":1}
===== sent =====
Content-Length: 52

{"method":"initialized","jsonrpc":"2.0","params":{}}
===== sent =====
Content-Length: 252

{"method":"workspace/didChangeWorkspaceFolders","jsonrpc":"2.0","params":{"event":{"added":[{"uri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","name":"/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch"}],"removed":[]}}}
===== sent =====
Content-Length: 4259

{"method":"textDocument/didOpen","jsonrpc":"2.0","params":{"textDocument":{"uri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch/domain/batch/alerts/fi/forced_update_FI90.go","version":2,"languageId":"go","text":"package fi\n\nimport (\n\t\"fmt\"\n\t\"sync\"\n\n\t\"github.com/figarocms/fi-alert-api/pkg/enum/applicationcode\"\n\t\"github.com/figarocms/fi-alert-api/pkg/enum/estatetype\"\n\t\"github.com/figarocms/fi-alert-batch/domain/alert\"\n\t\"github.com/figarocms/fi-alert-batch/domain/batch/criterias\"\n\t\"github.com/figarocms/fi-alert-batch/domain/enums\"\n\t\"github.com/figarocms/fi-alert-batch/domain/models\"\n\t\"github.com/figarocms/fi-alert-batch/domain/port\"\n\t\"github.com/figarocms/fi-alert-batch/domain/reportstate\"\n\t\"github.com/figarocms/fi-alert-batch/domain/services/email\"\n\t\"github.com/rs/zerolog/log\"\n)\n\nvar ForcedUpdateFID90Criteria = criterias.GenericCriterias{\n\tApplications:          []applicationcode.ApplicationCode{applicationcode.Explorimmo},\n\tEstateType:            []estatetype.EstateType{estatetype.EmptyEstateType},\n\tTransaction:           []enums.Transaction{enums.EmptyTransaction},\n\tRefuseNullSendingDate: true,\n}\n\nfunc ExecuteForcedUpdateFID90(af port.AlertRepository, searchApi port.IFISearchAPI, emailer email.IEmailService, worker int) models.BatchReport {\n\treport := models.BatchReport{}\n\treport.StatsByEmailType.ForcedUpdateFID90 = new(models.BrandStatistics)\n\treports := make(chan struct {\n\t\treport    reportstate.ReportState\n\t\tisProcess bool\n\t})\n\twg := sync.WaitGroup{}\n\n\talerts := fetchForcedUpdateFID90Alerts(af)\n\twg.Add(worker)\n\tfor i := 0; i < worker; i++ {\n\t\tgo func() {\n\t\t\tfor a := range alerts {\n\t\t\t\talertReportState, isProcess, err := processAlertForcedUpdateFID90(a, searchApi, emailer)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error().Err(err).Msgf(\"failed processing the alert (id: %s) during refresh old classifieds PLF batch\", a.ID)\n\t\t\t\t}\n\n\t\t\t\treports <- struct {\n\t\t\t\t\treport    reportstate.ReportState\n\t\t\t\t\tisProcess bool\n\t\t\t\t}{\n\t\t\t\t\talertReportState,\n\t\t\t\t\tisProcess,\n\t\t\t\t}\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\tgo func() {\n\t\tfor r := range reports {\n\t\t\tswitch r.report {\n\t\t\tcase reportstate.Error:\n\t\t\t\treport.StatsByEmailType.ForcedUpdateFID90.Failed += 1\n\t\t\tcase reportstate.Filtered:\n\t\t\t\treport.StatsByEmailType.ForcedUpdateFID90.Filtered += 1\n\t\t\tcase reportstate.Send:\n\t\t\t\treport.StatsByEmailType.ForcedUpdateFID90.Sent += 1\n\t\t\t}\n\n\t\t\tif r.isProcess {\n\t\t\t\treport.StatsByEmailType.ForcedUpdateFID90.Processed += 1\n\t\t\t\treport.plop\n\t\t\t}\n\t\t}\n\t}()\n\n\twg.Wait()\n\tclose(reports)\n\n\treturn report\n\n}\n\nfunc fetchForcedUpdateFID90Alerts(af port.AlertRepository) <-chan alert.Alert {\n\talerts := af.FetchGenericFIFI9(ForcedUpdateFID90Criteria)\n\treturn alerts\n}\n\nfunc processAlertForcedUpdateFID90(alert alert.Alert, searchApi port.IFISearchAPI, emailer email.IEmailService) (reportstate.ReportState, bool, error) {\n\tif len(alert.Locations) <= 0 {\n\t\treturn reportstate.Filtered, true, nil\n\t}\n\n\tavailableClassifieds, err := fetchForcedUpdateFID90(alert, searchApi)\n\tif err != nil {\n\t\treturn reportstate.Error, true, fmt.Errorf(\"failed to fetch forced update FI D90 for alert: %#v, %w\", alert, err)\n\t}\n\n\tif len(availableClassifieds) <= 0 {\n\t\treturn reportstate.Filtered, true, nil\n\t}\n\n\terr = sendForcedUpdateFID90(alert, availableClassifieds, emailer)\n\tif err != nil {\n\t\treturn reportstate.Error, true, err\n\t}\n\n\treturn reportstate.Send, true, nil\n\n}\n\nfunc fetchForcedUpdateFID90(\n\ta alert.Alert,\n\tsearchAPI port.IFISearchAPI,\n) ([]models.Classified, error) {\n\tavailableClassifieds, err := searchAPI.GetClassifiedsFromAlert(enums.ForcedUpdateFID90, a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn availableClassifieds, nil\n}\n\nfunc sendForcedUpdateFID90(\n\ta alert.Alert,\n\tclassifieds []models.Classified,\n\temailer email.IEmailService,\n) error {\n\t_, err := emailer.SendFIAlertMail(\n\t\tclassifieds,\n\t\tmodels.GetEmailType(a, enums.ForcedUpdateFID90),\n\t\ta,\n\t\tnew(models.ExecutionReport),\n\t)\n\n\treturn err\n}\n"}}}
===== stderr =====
serve.go:437: debug server listening at http://localhost:35629
===== received =====
Content-Length: 99

{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":4,"message":"Loading packages..."}}
===== received =====
Content-Length: 179

{"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","section":"gopls"}]},"id":1}
===== sent =====
Content-Length: 78

{"id":1,"jsonrpc":"2.0","result":[{"buildFlags":[],"hoverKind":"Structured"}]}
===== received =====
Content-Length: 690

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2024/08/14 10:14:32 Created View (#2)\n\tdirectory=/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch\n\tview_type=\"GoMod\"\n\troot_dir=\"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch\"\n\tgo_version=\"go version go1.22.6 linux/amd64\"\n\tbuild_flags=[]\n\tenv={GOOS:linux GOARCH:amd64 GOCACHE:/home/alban/.cache/go-build GOMODCACHE:/home/alban/prg/go/pkg/mod GOPATH:/home/alban/prg/go GOPRIVATE:github.com/figarocms GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GoVersion:22 GoVersionOutput:go version go1.22.6 linux/amd64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}}
===== received =====
Content-Length: 346

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2024/08/14 10:14:32 go/packages.Load #2\n\tview_id=\"2\"\n\tsnapshot=0\n\tdirectory=/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch\n\tquery=[/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch/... builtin]\n\tpackages=108\n\tduration=271.798729ms\n"}}
===== received =====
Content-Length: 106

{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":3,"message":"Finished loading packages."}}
===== received =====
Content-Length: 176

{"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]},"id":2}
===== sent =====
Content-Length: 38

{"id":2,"jsonrpc":"2.0","result":null}
===== received =====
Content-Length: 99

{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":4,"message":"Loading packages..."}}
===== received =====
Content-Length: 179

{"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","section":"gopls"}]},"id":3}
===== sent =====
Content-Length: 78

{"id":3,"jsonrpc":"2.0","result":[{"buildFlags":[],"hoverKind":"Structured"}]}
===== received =====
Content-Length: 560

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch/domain/batch/alerts/fi/forced_update_FI90.go","version":2,"diagnostics":[{"range":{"start":{"line":69,"character":11},"end":{"line":69,"character":15}},"severity":1,"code":"MissingFieldOrMethod","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#MissingFieldOrMethod"},"source":"compiler","message":"report.plop undefined (type models.BatchReport has no field or method plop)"}]}}

Here is the log file when I use the 1.X.X format in the go mod file and i have no highlight on the undefined method:

===== sent =====
Content-Length: 773

{"method":"initialize","jsonrpc":"2.0","id":1,"params":{"rootUri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","capabilities":{"workspace":{"workspaceFolders":true,"workspaceEdit":{"documentChanges":true},"configuration":true,"didChangeConfiguration":{"dynamicRegistration":true}},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["source.organizeImports","refactor.rewrite","refactor.extract"]}}},"completion":{"completionItem":{"snippetSupport":false}},"hover":{"contentFormat":["plaintext"]}}},"clientInfo":{"name":"vim-go"},"processId":13155,"workspaceFolders":[{"uri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","name":"/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch"}]}}
===== received =====
Content-Length: 261

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2024/08/14 10:16:02 Handshake session update\n\tupdate_session=3\n\tdebug_address=\"127.0.0.1:36735\"\n\tlogfile=\"\"\n\tserver=\"1\"\n\tgopls_path=\"/home/alban/prg/go/bin/gopls\"\n"}}
===== received =====
Content-Length: 4526

{"jsonrpc":"2.0","result":{"capabilities":{"textDocumentSync":{"change":2,"openClose":true,"save":{}},"completionProvider":{"triggerCharacters":["."]},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.inline","refactor.rewrite","source.assembly","source.doc","source.fixAll","source.freesymbols","source.organizeImports"],"resolveProvider":true},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"renameProvider":true,"foldingRangeProvider":true,"selectionRangeProvider":true,"executeCommandProvider":{"commands":["gopls.add_dependency","gopls.add_import","gopls.add_telemetry_counters","gopls.apply_fix","gopls.assembly","gopls.change_signature","gopls.check_upgrades","gopls.diagnose_files","gopls.doc","gopls.edit_go_directive","gopls.fetch_vulncheck_result","gopls.free_symbols","gopls.gc_details","gopls.generate","gopls.go_get_package","gopls.list_imports","gopls.list_known_packages","gopls.maybe_prompt_for_telemetry","gopls.mem_stats","gopls.regenerate_cgo","gopls.remove_dependency","gopls.reset_go_mod_diagnostics","gopls.run_go_work_command","gopls.run_govulncheck","gopls.run_tests","gopls.scan_imports","gopls.start_debugging","gopls.start_profile","gopls.stop_profile","gopls.test","gopls.tidy","gopls.toggle_gc_details","gopls.update_go_sum","gopls.upgrade_dependency","gopls.vendor","gopls.views","gopls.workspace_stats"]},"callHierarchyProvider":true,"semanticTokensProvider":{"full":true,"legend":{"tokenModifiers":[],"tokenTypes":[]},"range":true},"inlayHintProvider":{},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"gopls","version":"{\"GoVersion\":\"go1.22.6\",\"Path\":\"golang.org/x/tools/gopls\",\"Main\":{\"Path\":\"golang.org/x/tools/gopls\",\"Version\":\"v0.16.1\",\"Sum\":\"h1:1hO/dCeUvjEYx3V0rVvCtOkwnpEpqS29paE+Jw4dcAc=\",\"Replace\":null},\"Deps\":[{\"Path\":\"github.com/BurntSushi/toml\",\"Version\":\"v1.2.1\",\"Sum\":\"h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=\",\"Replace\":null},{\"Path\":\"github.com/google/go-cmp\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=\",\"Replace\":null},{\"Path\":\"golang.org/x/exp/typeparams\",\"Version\":\"v0.0.0-20221212164502-fae10dda9338\",\"Sum\":\"h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=\",\"Replace\":null},{\"Path\":\"golang.org/x/mod\",\"Version\":\"v0.18.0\",\"Sum\":\"h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=\",\"Replace\":null},{\"Path\":\"golang.org/x/sync\",\"Version\":\"v0.7.0\",\"Sum\":\"h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=\",\"Replace\":null},{\"Path\":\"golang.org/x/telemetry\",\"Version\":\"v0.0.0-20240607193123-221703e18637\",\"Sum\":\"h1:3Wt8mZlbFwG8llny+t18kh7AXxyWePFycXMuVdHxnyM=\",\"Replace\":null},{\"Path\":\"golang.org/x/text\",\"Version\":\"v0.16.0\",\"Sum\":\"h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=\",\"Replace\":null},{\"Path\":\"golang.org/x/tools\",\"Version\":\"v0.22.1-0.20240628205440-9c895dd76b34\",\"Sum\":\"h1:Kd+Z5Pm6uwYx3T2KEkeHMHUMZxDPb/q6b1m+zEcy62c=\",\"Replace\":null},{\"Path\":\"golang.org/x/vuln\",\"Version\":\"v1.0.4\",\"Sum\":\"h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=\",\"Replace\":null},{\"Path\":\"honnef.co/go/tools\",\"Version\":\"v0.4.7\",\"Sum\":\"h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs=\",\"Replace\":null},{\"Path\":\"mvdan.cc/gofumpt\",\"Version\":\"v0.6.0\",\"Sum\":\"h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=\",\"Replace\":null},{\"Path\":\"mvdan.cc/xurls/v2\",\"Version\":\"v2.5.0\",\"Sum\":\"h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=\",\"Replace\":null}],\"Settings\":[{\"Key\":\"-buildmode\",\"Value\":\"exe\"},{\"Key\":\"-compiler\",\"Value\":\"gc\"},{\"Key\":\"DefaultGODEBUG\",\"Value\":\"httplaxcontentlength=1,httpmuxgo121=1,panicnil=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1\"},{\"Key\":\"CGO_ENABLED\",\"Value\":\"1\"},{\"Key\":\"CGO_CFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CPPFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_CXXFLAGS\",\"Value\":\"\"},{\"Key\":\"CGO_LDFLAGS\",\"Value\":\"\"},{\"Key\":\"GOARCH\",\"Value\":\"amd64\"},{\"Key\":\"GOOS\",\"Value\":\"linux\"},{\"Key\":\"GOAMD64\",\"Value\":\"v1\"}],\"Version\":\"v0.16.1\"}"}},"id":1}
===== sent =====
Content-Length: 52

{"method":"initialized","jsonrpc":"2.0","params":{}}
===== sent =====
Content-Length: 252

{"method":"workspace/didChangeWorkspaceFolders","jsonrpc":"2.0","params":{"event":{"added":[{"uri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","name":"/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch"}],"removed":[]}}}
===== sent =====
Content-Length: 4259

{"method":"textDocument/didOpen","jsonrpc":"2.0","params":{"textDocument":{"uri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch/domain/batch/alerts/fi/forced_update_FI90.go","version":2,"languageId":"go","text":"package fi\n\nimport (\n\t\"fmt\"\n\t\"sync\"\n\n\t\"github.com/figarocms/fi-alert-api/pkg/enum/applicationcode\"\n\t\"github.com/figarocms/fi-alert-api/pkg/enum/estatetype\"\n\t\"github.com/figarocms/fi-alert-batch/domain/alert\"\n\t\"github.com/figarocms/fi-alert-batch/domain/batch/criterias\"\n\t\"github.com/figarocms/fi-alert-batch/domain/enums\"\n\t\"github.com/figarocms/fi-alert-batch/domain/models\"\n\t\"github.com/figarocms/fi-alert-batch/domain/port\"\n\t\"github.com/figarocms/fi-alert-batch/domain/reportstate\"\n\t\"github.com/figarocms/fi-alert-batch/domain/services/email\"\n\t\"github.com/rs/zerolog/log\"\n)\n\nvar ForcedUpdateFID90Criteria = criterias.GenericCriterias{\n\tApplications:          []applicationcode.ApplicationCode{applicationcode.Explorimmo},\n\tEstateType:            []estatetype.EstateType{estatetype.EmptyEstateType},\n\tTransaction:           []enums.Transaction{enums.EmptyTransaction},\n\tRefuseNullSendingDate: true,\n}\n\nfunc ExecuteForcedUpdateFID90(af port.AlertRepository, searchApi port.IFISearchAPI, emailer email.IEmailService, worker int) models.BatchReport {\n\treport := models.BatchReport{}\n\treport.StatsByEmailType.ForcedUpdateFID90 = new(models.BrandStatistics)\n\treports := make(chan struct {\n\t\treport    reportstate.ReportState\n\t\tisProcess bool\n\t})\n\twg := sync.WaitGroup{}\n\n\talerts := fetchForcedUpdateFID90Alerts(af)\n\twg.Add(worker)\n\tfor i := 0; i < worker; i++ {\n\t\tgo func() {\n\t\t\tfor a := range alerts {\n\t\t\t\talertReportState, isProcess, err := processAlertForcedUpdateFID90(a, searchApi, emailer)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error().Err(err).Msgf(\"failed processing the alert (id: %s) during refresh old classifieds PLF batch\", a.ID)\n\t\t\t\t}\n\n\t\t\t\treports <- struct {\n\t\t\t\t\treport    reportstate.ReportState\n\t\t\t\t\tisProcess bool\n\t\t\t\t}{\n\t\t\t\t\talertReportState,\n\t\t\t\t\tisProcess,\n\t\t\t\t}\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\tgo func() {\n\t\tfor r := range reports {\n\t\t\tswitch r.report {\n\t\t\tcase reportstate.Error:\n\t\t\t\treport.StatsByEmailType.ForcedUpdateFID90.Failed += 1\n\t\t\tcase reportstate.Filtered:\n\t\t\t\treport.StatsByEmailType.ForcedUpdateFID90.Filtered += 1\n\t\t\tcase reportstate.Send:\n\t\t\t\treport.StatsByEmailType.ForcedUpdateFID90.Sent += 1\n\t\t\t}\n\n\t\t\tif r.isProcess {\n\t\t\t\treport.StatsByEmailType.ForcedUpdateFID90.Processed += 1\n\t\t\t\treport.plop\n\t\t\t}\n\t\t}\n\t}()\n\n\twg.Wait()\n\tclose(reports)\n\n\treturn report\n\n}\n\nfunc fetchForcedUpdateFID90Alerts(af port.AlertRepository) <-chan alert.Alert {\n\talerts := af.FetchGenericFIFI9(ForcedUpdateFID90Criteria)\n\treturn alerts\n}\n\nfunc processAlertForcedUpdateFID90(alert alert.Alert, searchApi port.IFISearchAPI, emailer email.IEmailService) (reportstate.ReportState, bool, error) {\n\tif len(alert.Locations) <= 0 {\n\t\treturn reportstate.Filtered, true, nil\n\t}\n\n\tavailableClassifieds, err := fetchForcedUpdateFID90(alert, searchApi)\n\tif err != nil {\n\t\treturn reportstate.Error, true, fmt.Errorf(\"failed to fetch forced update FI D90 for alert: %#v, %w\", alert, err)\n\t}\n\n\tif len(availableClassifieds) <= 0 {\n\t\treturn reportstate.Filtered, true, nil\n\t}\n\n\terr = sendForcedUpdateFID90(alert, availableClassifieds, emailer)\n\tif err != nil {\n\t\treturn reportstate.Error, true, err\n\t}\n\n\treturn reportstate.Send, true, nil\n\n}\n\nfunc fetchForcedUpdateFID90(\n\ta alert.Alert,\n\tsearchAPI port.IFISearchAPI,\n) ([]models.Classified, error) {\n\tavailableClassifieds, err := searchAPI.GetClassifiedsFromAlert(enums.ForcedUpdateFID90, a)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn availableClassifieds, nil\n}\n\nfunc sendForcedUpdateFID90(\n\ta alert.Alert,\n\tclassifieds []models.Classified,\n\temailer email.IEmailService,\n) error {\n\t_, err := emailer.SendFIAlertMail(\n\t\tclassifieds,\n\t\tmodels.GetEmailType(a, enums.ForcedUpdateFID90),\n\t\ta,\n\t\tnew(models.ExecutionReport),\n\t)\n\n\treturn err\n}\n"}}}
===== stderr =====
serve.go:437: debug server listening at http://localhost:36735
===== received =====
Content-Length: 99

{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":4,"message":"Loading packages..."}}
===== received =====
Content-Length: 179

{"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","section":"gopls"}]},"id":1}
===== sent =====
Content-Length: 78

{"id":1,"jsonrpc":"2.0","result":[{"buildFlags":[],"hoverKind":"Structured"}]}
===== received =====
Content-Length: 690

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2024/08/14 10:16:02 Created View (#3)\n\tdirectory=/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch\n\tview_type=\"GoMod\"\n\troot_dir=\"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch\"\n\tgo_version=\"go version go1.22.6 linux/amd64\"\n\tbuild_flags=[]\n\tenv={GOOS:linux GOARCH:amd64 GOCACHE:/home/alban/.cache/go-build GOMODCACHE:/home/alban/prg/go/pkg/mod GOPATH:/home/alban/prg/go GOPRIVATE:github.com/figarocms GOFLAGS: GO111MODULE: GOTOOLCHAIN:auto GoVersion:22 GoVersionOutput:go version go1.22.6 linux/amd64\n ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}\n\tenv_overlay=[]\n"}}
===== received =====
Content-Length: 346

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2024/08/14 10:16:02 go/packages.Load #3\n\tview_id=\"3\"\n\tsnapshot=0\n\tdirectory=/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch\n\tquery=[/home/alban/prg/go/src/github.com/figarocms/fi-alert-batch/... builtin]\n\tpackages=108\n\tduration=256.449783ms\n"}}
===== received =====
Content-Length: 106

{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":3,"message":"Finished loading packages."}}
===== received =====
Content-Length: 176

{"jsonrpc":"2.0","method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"}]},"id":2}
===== sent =====
Content-Length: 38

{"id":2,"jsonrpc":"2.0","result":null}
===== received =====
Content-Length: 99

{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":4,"message":"Loading packages..."}}
===== received =====
Content-Length: 179

{"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch","section":"gopls"}]},"id":3}
===== sent =====
Content-Length: 78

{"id":3,"jsonrpc":"2.0","result":[{"buildFlags":[],"hoverKind":"Structured"}]}
===== received =====
Content-Length: 560

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/alban/prg/go/src/github.com/figarocms/fi-alert-batch/domain/batch/alerts/fi/forced_update_FI90.go","version":2,"diagnostics":[{"range":{"start":{"line":69,"character":11},"end":{"line":69,"character":15}},"severity":1,"code":"MissingFieldOrMethod","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#MissingFieldOrMethod"},"source":"compiler","message":"report.plop undefined (type models.BatchReport has no field or method plop)"}]}}
bhcleek commented 2 months ago

I'm not sure what's going on yet. Clearly, gopls provides the diagnostics in both cases. There's nothing about vim-go that varies highlighting behaviors based on the version listed in the go directive.