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

Fix gopackagesdriver for Go 1.18 by replicating stdlib and add test for stdliblist.go #3157

Merged
merged 18 commits into from
May 19, 2022

Commits on May 12, 2022

  1. stdliblist: Fix for Go 1.18 by replicating stdlib

    The stdliblist operation that the gopackagesdriver relies on fails on
    Go 1.18rc1 with the following error:
    
    ```
    external/go_sdk/src/crypto/elliptic/p256_asm.go:24:12: pattern p256_asm_table.bin: cannot embed irregular file p256_asm_table.bin
    ```
    
    We see this failure because Bazel builds a symlink tree of the GOROOT run
    `go list` with. However, since [CL 380475][1], the Go standard library uses
    `go:embed` to embed a file in `crypto/elliptic`, but `go:embed` does not
    support symlinks.
    
    [1]: https://go.dev/cl/380475
    
    Fix this by having stdliblist copy the relevant portions of the GOROOT to
    run `go list` with. This matches [what the stdlib action does][2].
    
    [2]: https://github.com/bazelbuild/rules_go/blob/e9a7054ff11a520e3b8aceb76a3ba44bb8da4c94/go/tools/builders/stdlib.go#L54-L57
    
    Resolves bazelbuild#3080
    abhinav authored and xytan0056 committed May 12, 2022
    Configuration menu
    Copy the full SHA
    a886327 View commit details
    Browse the repository at this point in the history
  2. test/stdlib: Depend on _list_json

    Add a dependency on `GoStdLib._list_json` to the stdlib test.
    This ensures that we can successfully build the JSON data needed by the
    gopackagesdriver.
    abhinav authored and xytan0056 committed May 12, 2022
    Configuration menu
    Copy the full SHA
    6c94802 View commit details
    Browse the repository at this point in the history
  3. Fix file paths relative to OUTPUT_BASE

    The prior version of this fix was incomplete because it generated
    incorrect relative paths.
    
    For example, before a path would be:
    
        __BAZEL_OUTPUT_BASE__/external/go_sdk/src/archive/tar/common.go
    
    But with the prior version of this change.
    
        __BAZEL_OUTPUT_BASE__/src/archive/tar/common.go
    
    It would drop the external/go_sdk from the path because the flattening
    logic in stdliblist makes these relative to the execRoot.
    
    We cannot overwrite external/go_sdk in execRoot because that's a path
    controlled by Bazel.
    
    Instead, create a parallel external/go_sdk under a new directory "root",
    and flatten paths relative to that.
    abhinav authored and xytan0056 committed May 12, 2022
    Configuration menu
    Copy the full SHA
    fa5c659 View commit details
    Browse the repository at this point in the history
  4. address comments

    xytan0056 committed May 12, 2022
    Configuration menu
    Copy the full SHA
    41c0139 View commit details
    Browse the repository at this point in the history

Commits on May 13, 2022

  1. wip

    xytan0056 committed May 13, 2022
    Configuration menu
    Copy the full SHA
    1de0b73 View commit details
    Browse the repository at this point in the history
  2. rebase

    recover tests/core/stdlib/stdlib_files.bzl
    xytan0056 committed May 13, 2022
    Configuration menu
    Copy the full SHA
    bcb289f View commit details
    Browse the repository at this point in the history
  3. buildifier

    xytan0056 committed May 13, 2022
    Configuration menu
    Copy the full SHA
    89e0cf6 View commit details
    Browse the repository at this point in the history
  4. clean up

    xytan0056 committed May 13, 2022
    Configuration menu
    Copy the full SHA
    68b94d1 View commit details
    Browse the repository at this point in the history

Commits on May 16, 2022

  1. address comments

    xytan0056 committed May 16, 2022
    Configuration menu
    Copy the full SHA
    8b0dde2 View commit details
    Browse the repository at this point in the history

Commits on May 18, 2022

  1. works

    xytan0056 committed May 18, 2022
    Configuration menu
    Copy the full SHA
    0c12fc9 View commit details
    Browse the repository at this point in the history
  2. simpler version

    xytan0056 committed May 18, 2022
    Configuration menu
    Copy the full SHA
    d0e87d6 View commit details
    Browse the repository at this point in the history
  3. assume absolute path

    xytan0056 committed May 18, 2022
    Configuration menu
    Copy the full SHA
    309f5de View commit details
    Browse the repository at this point in the history
  4. test

    xytan0056 committed May 18, 2022
    Configuration menu
    Copy the full SHA
    7913ea3 View commit details
    Browse the repository at this point in the history
  5. use external/go_sdk

    xytan0056 committed May 18, 2022
    Configuration menu
    Copy the full SHA
    ca25b77 View commit details
    Browse the repository at this point in the history
  6. buildifier

    xytan0056 committed May 18, 2022
    Configuration menu
    Copy the full SHA
    29449cc View commit details
    Browse the repository at this point in the history
  7. use workDir

    xytan0056 committed May 18, 2022
    Configuration menu
    Copy the full SHA
    9a85829 View commit details
    Browse the repository at this point in the history
  8. address comments

    xytan0056 committed May 18, 2022
    Configuration menu
    Copy the full SHA
    a9f613a View commit details
    Browse the repository at this point in the history

Commits on May 19, 2022

  1. minor renaming

    xytan0056 committed May 19, 2022
    Configuration menu
    Copy the full SHA
    e568d43 View commit details
    Browse the repository at this point in the history