NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.07k stars 14.13k forks source link

gopls fails due to `GOPROXY=off` #177632

Closed WhyNotHugo closed 2 years ago

WhyNotHugo commented 2 years ago

Describe the bug

GOPROXY=off is set when building nix packages to avoid go itself from performing any network access to fetch new versions and alike.

gopls seems to somehow "retain" this value; even when using GOPROXY=direct gopls, it still uses value off. I think maybe this value is baked into the binary at build time...?

When trying to perform code navigations, it errors:

gopls: 0: err: exit status 1: stderr: go: github.com/adrg/xdg@v0.3.3: module lookup disabled by GOPROXY=off                  
go: github.com/adrg/xdg@v0.3.3: module lookup disabled by GOPROXY=off

Note that this affects gopls at runtime; module resolution is necessary for things like code navigation.

Steps To Reproduce

Expected behavior

Should work.

Additional context

Notify maintainers

@mic92 @rski @SuperSandro2000 @zimbatm

Metadata

> nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.18.2-arch1-1, Arch Linux, noversion, rolling`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.9.1`
 - channels(hugo): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/hugo/channels/nixpkgs`
rski commented 2 years ago

can you post the output of go env and possibly that of cat $(go env GOENV)?

WhyNotHugo commented 2 years ago
> go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/hugo/.cache/go-build"
GOENV="/home/hugo/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/hugo/.cache/golang/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/hugo/.cache/golang"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/nix/store/v6sdabcswxfmrpc9kd2mcxrbbds0fjds-go-1.17.10/share/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/nix/store/v6sdabcswxfmrpc9kd2mcxrbbds0fjds-go-1.17.10/share/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.10"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/hugo/XXXXXXX/go.mod"
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-build3258002267=/tmp/go-build -gno-record-gcc-switch
es"
> cat $(go env GOENV)
cat: /home/hugo/.config/go/env: No such file or directory
SuperSandro2000 commented 2 years ago

Are you using nix-shell? Is that variable somehow bleeding into your environment?

WhyNotHugo commented 2 years ago

I'm setting GOPROXY="direct" explicitly myself.

rski commented 2 years ago

are you using some variant of vim? what does :echo $GOPROXY say?

WhyNotHugo commented 2 years ago

are you using some variant of vim?

It's neovim.

I'm using this flake: https://git.sr.ht/~whynothugo/dotfiles/tree/7e106262/item/v/flake.nix

I've added pkgs.go to line 19 for debugging this too.

what does :echo $GOPROXY say?

direct

rski commented 2 years ago

hmm, is perhaps the gopls in your path a wrapper for the actual gopls binary? Maybe that wrapper is setting GOPROXY

WhyNotHugo commented 2 years ago
> which gopls
/nix/store/sbi3zrg9h4ik0aci6d2wbqif8skwa23g-gopls-0.8.4/bin/gopls

> file $(which gopls)
/nix/store/sbi3zrg9h4ik0aci6d2wbqif8skwa23g-gopls-0.8.4/bin/gopls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamicall
y linked, interpreter /nix/store/fz33c1mfi2krpg1lwzizfw28kj705yg0-glibc-2.34-210/lib/ld-linux-x86-64.so.2, Go BuildID=lMqRYihlEr0n
5Y8uaH-C/jJSgXPAEN4D-L3AnGUNN/Yat0zj3QOjI43Ooah3bF/oigJ1siUX9Wl-And8ilC, not stripped
rski commented 2 years ago

I read the source a bit, and have two suggestions:

Admittedly, I think gopls is getting confused somehow here and setting GOPROXY=off when it should not

rski commented 2 years ago

there is also https://github.com/golang/go/issues/53313 upstream. At this point I think it's very unlikely it is a nix specific issue. Perhaps it is some interaction with the text editor lsp plugin that is causing this. The go repo has instructions on how to debug this https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md#capture-logs

rski commented 2 years ago

to be clear, if setting allowImplicitNetworkAccess works, then it definitely is not a nix issue as that would mean gopls is injecting the variable.

Mic92 commented 2 years ago

Is it some sort of security feature that the authors of gopls don't want to this network access or what is the reasoning behind it?

rski commented 2 years ago

the reasoning is explained in https://github.com/golang/tools/commit/43adb69d7e9407736bb2eda6bc96c80299187b0e

WhyNotHugo commented 2 years ago

I read the source a bit, and have two suggestions:

what if you build gopls from source in this workspace? does that work?
does setting allowImplicitNetworkAccess work around this issue?

I'm not building gopls; I'm using the one provided by nixpkgs as_is. I'm not entirely certain how to build it inside this environment. Any pointers?


FWIW, the arch package works out the box, and doesn't seem to be changing any upstream defaults. This makes me think it's not an upstream issue: https://github.com/archlinux/svntogit-community/blob/packages/gopls/trunk/PKGBUILD


Using -logfile creates an empty log file and never writes anything to it, even when using -vv.

Does gopls work for anyone else here? I find that for projects with any dependencies, most functionality will fail entirely with the same error.

WhyNotHugo commented 2 years ago

Oh, using -rpc.trace did yield logs:

[Trace - 09:26:12.708 AM] Sending request 'initialize - (1)'.
Params: {"rootPath":"\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor","rootUri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor","clientInfo":{"name":"Neovim","version":"0.7.0"},"initializationOptions":{},"trace":"off","processId":null,"capabilities":{"workspace":{"workspaceEdit":{"resourceOperations":["rename","create","delete"]},"workspaceFolders":true,"configuration":true,"symbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"dynamicRegistration":false,"hierarchicalWorkspaceSymbolSupport":true},"applyEdit":true},"window":{"workDoneProgress":true,"showMessage":{"messageActionItem":{"additionalPropertiesSupport":false}},"showDocument":{"support":false}},"callHierarchy":{"dynamicRegistration":false},"textDocument":{"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"activeParameterSupport":true,"parameterInformation":{"labelOffsetSupport":true}}},"rename":{"prepareSupport":true,"dynamicRegistration":false},"codeAction":{"dataSupport":true,"dynamicRegistration":false,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","Empty","QuickFix","Refactor","RefactorExtract","RefactorInline","RefactorRewrite","Source","SourceOrganizeImports","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"references":{"dynamicRegistration":false},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"documentSymbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":true},"synchronization":{"didSave":true,"dynamicRegistration":false,"willSave":false,"willSaveWaitUntil":false},"typeDefinition":{"linkSupport":true},"documentHighlight":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]}},"implementation":{"linkSupport":true},"definition":{"linkSupport":true},"declaration":{"linkSupport":true},"completion":{"completionItem":{"deprecatedSupport":false,"documentationFormat":["markdown","plaintext"],"snippetSupport":false,"commitCharactersSupport":false,"preselectSupport":false},"dynamicRegistration":false,"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"contextSupport":false}}},"workspaceFolders":[{"name":"\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor","uri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor"}]}

[Trace - 09:26:12.710 AM] Received response 'initialize - (1)' in 1ms.
Result: {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":["."],"completionItem":{}},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["quickfix","refactor.extract","refactor.rewrite","source.fixAll","source.organizeImports"]},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":""},"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"executeCommandProvider":{"commands":["gopls.add_dependency","gopls.add_import","gopls.apply_fix","gopls.check_upgrades","gopls.edit_go_directive","gopls.gc_details","gopls.generate","gopls.generate_gopls_mod","gopls.go_get_package","gopls.list_imports","gopls.list_known_packages","gopls.regenerate_cgo","gopls.remove_dependency","gopls.run_tests","gopls.run_vulncheck_exp","gopls.start_debugging","gopls.test","gopls.tidy","gopls.toggle_gc_details","gopls.update_go_sum","gopls.upgrade_dependency","gopls.vendor"]},"callHierarchyProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"serverInfo":{"name":"gopls","version":"{\"GoVersion\":\"go1.18.2\",\"Path\":\"golang.org/x/tools/gopls\",\"Main\":{\"Path\":\"golang.org/x/tools/gopls\",\"Version\":\"(devel)\",\"Sum\":\"\",\"Replace\":null},\"Deps\":[{\"Path\":\"github.com/BurntSushi/toml\",\"Version\":\"v1.0.0\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"github.com/google/go-cmp\",\"Version\":\"v0.5.7\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"github.com/sergi/go-diff\",\"Version\":\"v1.1.0\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"golang.org/x/exp/typeparams\",\"Version\":\"v0.0.0-20220218215828-6cf2b201936e\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"golang.org/x/mod\",\"Version\":\"v0.6.0-dev.0.20220419223038-86c51ed26bb4\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"golang.org/x/sync\",\"Version\":\"v0.0.0-20210220032951-036812b2e83c\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"golang.org/x/sys\",\"Version\":\"v0.0.0-20220209214540-3681064d5158\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"golang.org/x/text\",\"Version\":\"v0.3.7\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"golang.org/x/tools\",\"Version\":\"v0.1.11-0.20220513164230-dfee1649af67\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"golang.org/x/vuln\",\"Version\":\"v0.0.0-20220503210553-a5481fb0c8be\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"honnef.co/go/tools\",\"Version\":\"v0.3.0\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"mvdan.cc/gofumpt\",\"Version\":\"v0.3.0\",\"Sum\":\"\",\"Replace\":null},{\"Path\":\"mvdan.cc/xurls/v2\",\"Version\":\"v2.4.0\",\"Sum\":\"\",\"Replace\":null}],\"Settings\":[{\"Key\":\"-compiler\",\"Value\":\"gc\"},{\"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.8.4\"}"}}

[Trace - 09:26:12.750 AM] Sending notification 'initialized'.
Params: {}

[Trace - 09:26:12.750 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {"settings":{"gopls":{"staticcheck":true}}}

[Trace - 09:26:12.750 AM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"text":"package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"os\"\n\t\"path\/filepath\"\n\t\"time\"\n\n\t\"github.com\/aws\/aws-sdk-go\/aws\/session\"\n\t\"github.com\/aws\/aws-sdk-go\/service\/s3\/s3manager\"\n\tsentry \"github.com\/getsentry\/sentry-go\"\n)\n\n\/\/ Use ` go build -ldflags \"-X main.Version=$VERSION\"` to override.\nvar Version string = \"unversioned\"\n\n\/\/ Get an environment variable or panic if it is undefined.\nfunc getRequiredEnv(key string) string {\n\tvalue, ok := os.LookupEnv(key)\n\tif !ok {\n\t\tlog.Fatalf(\"%s is unset\", key)\n\t}\n\n\treturn value\n}\n\nfunc ServiceMainLoop() {\n\tlog.Printf(\"Running Tailor version %s.\", Version)\n\n\tsourcesDir := getRequiredEnv(\"TAILOR_SOURCE\")\n\tnamespace := getRequiredEnv(\"TAILOR_SOURCE_NAMESPACE\")\n\tsqsQueue := getRequiredEnv(\"TAILOR_QUEUE\")\n\tbucketName := getRequiredEnv(\"TAILOR_TARGET\")\n\n\t\/\/ TODO: Set a SENTRY_DSN.\n\terr := sentry.Init(sentry.ClientOptions{\n\t\tEnvironment: sqsQueue, \/\/ There's one environment per queue.\n\t\tRelease:     Version,\n\t\tDebug:       true, \/\/ TODO: Disable this some day before doing live.\n\t})\n\tif err != nil {\n\t\tlog.Panicln(\"Initialising sentry failed:\", err)\n\t}\n\n\t\/\/ Flush buffered events before the program terminates.\n\t\/\/ Set the timeout to the maximum duration the program can afford to wait.\n\tdefer sentry.Flush(2 * time.Second)\n\n\tqueue, err := NewQueue(sqsQueue)\n\tif err != nil {\n\t\tlog.Panicln(\"Error initialising SQS queue:\", err)\n\t}\n\n\tfor {\n\t\tjob, err := queue.NextJob()\n\t\tif err != nil {\n\t\t\tlog.Panicln(\"Error getting next job:\", err)\n\t\t}\n\n\t\tlog.Println(\"Got a job:\", job)\n\n\t\tsourcesPath := filepath.Join(sourcesDir, \"\/recordings\/\", namespace, job.Env, job.SessionToken)\n\t\ttargetPath := filepath.Join(os.TempDir(), job.Env, job.SessionToken)\n\n\t\tsession := NewSession(sourcesPath, targetPath)\n\t\terr = session.Process()\n\t\tif err != nil {\n\t\t\tlog.Panicln(\"Error procesing session:\", err)\n\t\t}\n\n\t\tlog.Println(\"Uploading stiched session to:\", bucketName)\n\n\t\tfor _, outputFilename := range session.GetOutputNames() {\n\t\t\tfile, err := os.Open(outputFilename)\n\t\t\tif err != nil {\n\t\t\t\tlog.Panicln(\"Error opening a stitched files:\", err)\n\t\t\t}\n\n\t\t\tobjectKey := filepath.Join(job.Env, job.SessionToken, filepath.Base(outputFilename))\n\t\t\terr = uploadFileToS3(bucketName, objectKey, file)\n\t\t\tif err != nil {\n\t\t\t\tlog.Panicln(\"Error uploading file to S3:\", err)\n\t\t\t}\n\t\t}\n\n\t\t\/\/ TODO: delete originals\n\n\t\tjob.Done()\n\t}\n\n}\n\nfunc uploadFileToS3(bucketName string, keyName string, blob io.Reader) error {\n\tsess := session.Must(session.NewSession())\n\tuploader := s3manager.NewUploader(sess)\n\n\t_, err := uploader.Upload(&s3manager.UploadInput{\n\t\tBucket: &bucketName,\n\t\tKey:    &keyName,\n\t\tBody:   blob,\n\t})\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to upload file to S3: %v\", err)\n\t}\n\n\treturn nil\n}\n","version":0,"languageId":"go","uri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor\/service.go"}}

[Trace - 09:26:12.751 AM] Received request 'window/workDoneProgress/create - (1)'.
Params: {"token":"5577006791947779410"}

[Trace - 09:26:12.754 AM] Sending response 'window/workDoneProgress/create - (1)' in 3ms.
Result: 

[Trace - 09:26:12.754 AM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"begin","title":"Setting up workspace","message":"Loading packages..."}}

[Trace - 09:26:12.754 AM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor","section":"gopls"}]}

[Trace - 09:26:12.764 AM] Sending response 'workspace/configuration - (2)' in 9ms.
Result: [{"staticcheck":true}]

[Trace - 09:26:12.778 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2022/06/17 09:26:12 go env for /home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n(root /home/hugo/clones/gitlab.com/proctorexam1/tools/tailor)\n(go version go version go1.18.3 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGOCACHE=/home/hugo/.cache/go-build\nGOPRIVATE=\nGONOSUMDB=\nGOPATH=/home/hugo/.cache/golang\nGOROOT=/usr/lib/go\nGOFLAGS=\nGOINSECURE=\nGOMOD=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/go.mod\nGONOPROXY=\nGO111MODULE=\nGOMODCACHE=/home/hugo/.cache/golang/pkg/mod\nGOWORK=\nGOPROXY=direct\nGOSUMDB=sum.golang.org\n\n"}

[Trace - 09:26:12.792 AM] Sending request 'textDocument/codeAction - (2)'.
Params: {"range":{"start":{"line":66,"character":13},"end":{"line":66,"character":13}},"textDocument":{"uri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor\/service.go"},"context":{"diagnostics":[]}}

[Trace - 09:26:12.792 AM] Sending request 'textDocument/documentSymbol - (3)'.
Params: {"textDocument":{"uri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor\/service.go"}}

[Trace - 09:26:12.816 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 go/packages.Load: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\ngo: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3\ngo: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3\ngo: downloading github.com/aws/aws-sdk-go v1.44.4\ngo: downloading github.com/getsentry/sentry-go v0.13.0\ngo: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\n\n\tsnapshot=0\n\tdirectory=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n\tquery=[builtin tailor/...]\n\tpackages=0\n"}

[Trace - 09:26:12.816 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 initial workspace load failed: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\ngo: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3\ngo: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3\ngo: downloading github.com/aws/aws-sdk-go v1.44.4\ngo: downloading github.com/getsentry/sentry-go v0.13.0\ngo: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\n: packages.Load error\n"}

[Trace - 09:26:12.816 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 workspace packages: diagnosing file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/go.mod: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\ngo: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3\ngo: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3\ngo: downloading github.com/aws/aws-sdk-go v1.44.4\ngo: downloading github.com/getsentry/sentry-go v0.13.0\ngo: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\n: packages.Load error\n"}

[Trace - 09:26:12.817 AM] Received notification '$/progress'.
Params: {"token":"5577006791947779410","value":{"kind":"end","message":"Finished loading packages."}}

[Trace - 09:26:12.817 AM] Received request 'workspace/configuration - (3)'.
Params: {"items":[{"section":"gopls"}]}

[Trace - 09:26:12.818 AM] Sending response 'workspace/configuration - (3)' in 0ms.
Result: [{"staticcheck":true}]

[Trace - 09:26:12.818 AM] Received request 'workspace/configuration - (4)'.
Params: {"items":[{"scopeUri":"file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor","section":"gopls"}]}

[Trace - 09:26:12.819 AM] Sending response 'workspace/configuration - (4)' in 0ms.
Result: [{"staticcheck":true}]

[Trace - 09:26:12.825 AM] Received request 'window/workDoneProgress/create - (5)'.
Params: {"token":"8674665223082153551"}

[Trace - 09:26:12.826 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 errors loading workspace: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\ngo: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3\ngo: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3\ngo: downloading github.com/aws/aws-sdk-go v1.44.4\ngo: downloading github.com/getsentry/sentry-go v0.13.0\ngo: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\n: packages.Load error\n\tsnapshot=0\n\tdirectory=file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n"}

[Trace - 09:26:12.826 AM] Sending response 'window/workDoneProgress/create - (5)' in 0ms.
Result: 

[Trace - 09:26:12.826 AM] Received notification '$/progress'.
Params: {"token":"8674665223082153551","value":{"kind":"begin","title":"Error loading workspace","message":"err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128: \tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com go: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3 go: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3 go: downloading github.com/aws/aws-sdk-go v1.44.4 go: downloading github.com/getsentry/sentry-go v0.13.0 go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128: \tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com : packages.Load error"}}

[Trace - 09:26:12.826 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/go.mod","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":13}},"severity":1,"source":"go list","message":"err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\ngo: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3\ngo: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3\ngo: downloading github.com/aws/aws-sdk-go v1.44.4\ngo: downloading github.com/getsentry/sentry-go v0.13.0\ngo: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\n: packages.Load error"}]}

[Trace - 09:26:12.826 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 workspace packages: diagnosing file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/go.mod: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\ngo: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3\ngo: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3\ngo: downloading github.com/aws/aws-sdk-go v1.44.4\ngo: downloading github.com/getsentry/sentry-go v0.13.0\ngo: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\n: packages.Load error\n"}

[Trace - 09:26:12.837 AM] Received notification '$/progress'.
Params: {"token":"8674665223082153551","value":{"kind":"report","message":"err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128: \tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com go: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3 go: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3 go: downloading github.com/aws/aws-sdk-go v1.44.4 go: downloading github.com/getsentry/sentry-go v0.13.0 go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128: \tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com : packages.Load error"}}

[Trace - 09:26:12.837 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 errors loading workspace: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\ngo: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3\ngo: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3\ngo: downloading github.com/aws/aws-sdk-go v1.44.4\ngo: downloading github.com/getsentry/sentry-go v0.13.0\ngo: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\n: packages.Load error\n\tsnapshot=0\n\tdirectory=file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n"}

[Trace - 09:26:12.861 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 go/packages.Load: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\ngo: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\n\n\tsnapshot=1\n\tdirectory=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n\tquery=[file=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/service.go]\n\tpackages=0\n"}

[Error - Received] 09:26:12.864 AM #2 err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off
go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off
: packages.Load error

[Trace - 09:26:12.864 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 go/packages.Load: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\ngo: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\n\n\tsnapshot=1\n\tdirectory=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n\tquery=[file=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/service.go]\n\tpackages=0\n"}

[Trace - 09:26:12.901 AM] Received response 'textDocument/documentSymbol - (3)' in 109ms.
Result: []

[Trace - 09:26:12.902 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 go/packages.Load: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\ngo: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\n\n\tsnapshot=1\n\tdirectory=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n\tquery=[file=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/service.go]\n\tpackages=0\n"}

[Trace - 09:26:12.902 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:12 DocumentSymbols failed: getting file for DocumentSymbols: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\ngo: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\n: packages.Load error\n\tURI=file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/service.go\n"}

[Trace - 09:26:13.080 AM] Sending request 'textDocument/definition - (4)'.
Params: {"textDocument":{"uri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor\/service.go"},"position":{"line":66,"character":13}}

[Trace - 09:26:13.094 AM] Sending request 'textDocument/codeAction - (5)'.
Params: {"range":{"start":{"line":66,"character":13},"end":{"line":66,"character":13}},"textDocument":{"uri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor\/service.go"},"context":{"diagnostics":[]}}

[Trace - 09:26:13.094 AM] Sending request 'textDocument/documentSymbol - (6)'.
Params: {"textDocument":{"uri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/proctorexam1\/tools\/tailor\/service.go"}}

[Trace - 09:26:13.112 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:13 workspace packages: diagnosing file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/go.mod: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\ngo: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3\ngo: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3\ngo: downloading github.com/aws/aws-sdk-go v1.44.4\ngo: downloading github.com/getsentry/sentry-go v0.13.0\ngo: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\n: packages.Load error\n"}

[Error - Received] 09:26:13.117 AM #4 err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off
go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off
: packages.Load error

[Trace - 09:26:13.117 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:13 go/packages.Load: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\ngo: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\n\n\tsnapshot=1\n\tdirectory=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n\tquery=[file=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/service.go]\n\tpackages=0\n"}

[Trace - 09:26:13.121 AM] Received notification '$/progress'.
Params: {"token":"8674665223082153551","value":{"kind":"report","message":"err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128: \tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com go: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3 go: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3 go: downloading github.com/aws/aws-sdk-go v1.44.4 go: downloading github.com/getsentry/sentry-go v0.13.0 go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128: \tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com : packages.Load error"}}

[Trace - 09:26:13.121 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:13 errors loading workspace: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\ngo: downloading github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3\ngo: downloading github.com/aws/aws-sdk-go-v2/config v1.15.3\ngo: downloading github.com/aws/aws-sdk-go v1.44.4\ngo: downloading github.com/getsentry/sentry-go v0.13.0\ngo: github.com/aws/aws-sdk-go@v1.44.4: reading github.com/aws/aws-sdk-go/go.mod at revision v1.44.4: git ls-remote -q origin in /home/hugo/.cache/golang/pkg/mod/cache/vcs/b3c0b920408a036a00409211751cef8a0f1a5493ca7145bea33987ab25941e1c: exit status 128:\n\tfatal: unable to access 'https://github.com/aws/aws-sdk-go/': Could not resolve host: github.com\n: packages.Load error\n\tsnapshot=1\n\tdirectory=file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n"}

[Error - Received] 09:26:13.151 AM #5 err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off
go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off
: packages.Load error

[Trace - 09:26:13.151 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:13 go/packages.Load: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\ngo: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\n\n\tsnapshot=1\n\tdirectory=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n\tquery=[file=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/service.go]\n\tpackages=0\n"}

[Trace - 09:26:13.182 AM] Received response 'textDocument/documentSymbol - (6)' in 87ms.
Result: []

[Trace - 09:26:13.182 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:13 go/packages.Load: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\ngo: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\n\n\tsnapshot=1\n\tdirectory=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor\n\tquery=[file=/home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/service.go]\n\tpackages=0\n"}

[Trace - 09:26:13.182 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2022/06/17 09:26:13 DocumentSymbols failed: getting file for DocumentSymbols: err: exit status 1: stderr: go: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\ngo: github.com/aws/aws-sdk-go@v1.44.4: module lookup disabled by GOPROXY=off\n: packages.Load error\n\tURI=file:///home/hugo/clones/gitlab.com/proctorexam1/tools/tailor/service.go\n"}

Looks like network is outright failng due to DNS error, but the error message shown says module lookup disabled by GOPROXY=off. It might be that the error message is mistaken and the issue is something else.

WhyNotHugo commented 2 years ago

Indeed, the issue was DNS not working in this environment. The error wrong error message is shown (this sounds like a bug in gopls), and that sent on a wild goose chase.

Thanks for the assistance here, sorry for the noise!

rski commented 2 years ago

wow, never would have guessed that