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

x/tools/gopls: cannot use func from same package #44831

holooooo opened this issue Mar 6, 2021 · 2 comments

x/tools/gopls: cannot use func from same package #44831

holooooo opened this issue Mar 6, 2021 · 2 comments


Copy link

@holooooo holooooo commented Mar 6, 2021

ATTENTION: Please answer these questions BEFORE submitting your issue. Thanks!

What did you do?

declare a function name listenWindows in package router
and try to run it

What did you expect to see?

listenWindows can be used in other file of router package

What did you see instead?

vscode alert undeclared name: listenWindows

use go run or go test also have same problem

when I change the file which contain listenWindows file name from router_windows.go to router_window.go, this problem is solved immediately.Once rename back, it alert again

I have try to remove ~/.cache, reinstall go, upgrade go from 1.15.7 to 1.15.8 or 1.16, run go clean -cache. it all useless

Build info v0.6.6 h1:GmCsAKZMEb1BD1BTWnQrMyx4FmNThlEsmuFiJbLBXio= h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY= h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= h1:XzEjy9Ks1MwmcJOarbxTnL/AqHtzsRfRzAwfDhII2lE= h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= h1:EVDuO03OCZwpV2t/tLLxPmPiomagMoBOgfPt0FM+4IY= h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw= h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
@gopherbot gopherbot added this to the Unreleased milestone Mar 6, 2021
Copy link

@AlexRouSg AlexRouSg commented Mar 6, 2021

Files that are named _windows.go will only be compiled and included if you are compiling for windows.

If a file's name, after stripping the extension and a possible _test suffix, matches any of the following patterns:

  • *_GOOS
  • *_GOARCH

(example: source_windows_amd64.go) where GOOS and GOARCH represent any known operating system and architecture values respectively, then the file is considered to have an implicit build constraint requiring those terms (in addition to any explicit constraints in the file).

Copy link

@holooooo holooooo commented Mar 6, 2021

a this, i got it. thank you very much! @AlexRouSg

@holooooo holooooo closed this Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants