Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Unable to parse correctly libraries for a different OS #1941

Closed
Nhoya opened this issue Sep 25, 2018 · 4 comments
Closed

Unable to parse correctly libraries for a different OS #1941

Nhoya opened this issue Sep 25, 2018 · 4 comments

Comments

@Nhoya
Copy link

Nhoya commented Sep 25, 2018

Hi, I have a small issue with the latest version of the extension.

I'm unable to use the extension calling methods for other platforms since the function is not recognised

Steps to Reproduce:

On linux just create a file with:

package main

import (
	"fmt"

	"golang.org/x/sys/windows/registry"
)

func GetSystemInfo() error {

	k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
	if err != nil {
		return (err)
	}
	defer k.Close()
	productName, _, err := k.GetStringValue("ProductName")
	if err != nil {
		return (err)
	}

	fmt.Printf("%s\n", productName)
	return nil
}

func main() {
	err := GetSystemInfo()
	if err != nil {
		panic(err)
	}
}

as you can see here the call to registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE) is not recognised

immagine

building it manually using GOOS=windows will build succesfully

@Nhoya Nhoya changed the title Unable to parse correctly libraries for others OS Unable to parse correctly libraries for a different OS Sep 25, 2018
@Nhoya
Copy link
Author

Nhoya commented Sep 26, 2018

Ok I found out that the issue also affects the package creation, creating a file called myfile_windows.go and adding it to a new package will trigger an error can't load package: package my_project_path_here: build constraints exclude all Go files in my_project_path_here I suspect this may be related to golang/go#24068

@ramya-rao-a
Copy link
Contributor

In your first comment, did the file have the suffix _windows.go?

If no, then you have to set GOOS=windows specifically, otherwise there is no way for the editor to know which platform to use for GOOS

If yes, this issue is covered in #1848.

@Nhoya
Copy link
Author

Nhoya commented Sep 28, 2018

Yes you are indeed right, my issue is coverd in #1848 I think we can close this and continue there

@Nhoya Nhoya closed this as completed Sep 28, 2018
@ramya-rao-a
Copy link
Contributor

Thanks @Nhoya
Please upvote #1848 so that we know how many users are seeing this issue

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants