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

remove hardcoded stdlib packages #138

Merged
merged 2 commits into from
Feb 21, 2023
Merged

Conversation

xytan0056
Copy link
Contributor

@xytan0056 xytan0056 commented Feb 16, 2023

currently the standard list is hardcoded, we can load this from x/tools/go/packages, which is already a dependency.
This means whenever for the same release, different toolchains install could have different the package list. So we don't have to manually maintain this list to include everything stdlib

unit tested

Signed-off-by: Xiaoyang Tan <tanx@uber.com>
@daixiang0
Copy link
Owner

I have a question: if we use 1.9 toolchain, users use 1.10, the newer packages cannot be detected, is it right? If so, we can not use this way.

@xytan0056
Copy link
Contributor Author

I have a question: if we use 1.9 toolchain, users use 1.10, the newer packages cannot be detected, is it right? If so, we can not use this way.

indeed. Maybe I need to reword the PR. But wouldn't we already have this issue with current implementation? The hardcoded list cannot cover all packages, so might as well make it accustomed to users' toolchains. e.g.

func main() {
        pkgs, err := packages.Load(nil, "std")
        if err != nil {
                panic(err)
        }

        fmt.Println(pkgs)
        // go1.16.1 run ./... => 212
        // go1.18.3 run ./... => 233
        // go1.19.4 run ./... => 241
        fmt.Println(len(pkgs)) 
}

I believe when users run go1.x.x install it'll refer to that version

@daixiang0
Copy link
Owner

You are right, please fix CI then we can get it.

Signed-off-by: Xiaoyang Tan <tanx@uber.com>
@daixiang0
Copy link
Owner

@xytan0056 thanks for your contribution!

@daixiang0 daixiang0 merged commit c19c1aa into daixiang0:master Feb 21, 2023
daixiang0 added a commit that referenced this pull request Mar 13, 2023
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

Successfully merging this pull request may close these issues.

2 participants