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

Go module support #941

Merged
merged 5 commits into from
May 27, 2020
Merged

Go module support #941

merged 5 commits into from
May 27, 2020

Commits on May 22, 2020

  1. builder: move Go version code to goenv package

    This is necessary to avoid a circular dependency in the loader (which
    soon will need to read the Go version) and because it seems like a
    better place anyway.
    aykevl committed May 22, 2020
    Configuration menu
    Copy the full SHA
    d9e7a1b View commit details
    Browse the repository at this point in the history

Commits on May 23, 2020

  1. main: move TinyGo version to goenv

    This is needed to make it available to more packages, for caching
    purposes.
    
    For caching, the version itself may not be enough during development.
    But for regular releases, the version provides some protection against
    accidentally using a cache entry that is invalid in a newer version.
    aykevl committed May 23, 2020
    Configuration menu
    Copy the full SHA
    0319368 View commit details
    Browse the repository at this point in the history
  2. main: fix test subcommand

    It was broken for quite some time without anybody noticing...
    aykevl committed May 23, 2020
    Configuration menu
    Copy the full SHA
    4e264dd View commit details
    Browse the repository at this point in the history
  3. loader: merge roots from both Go and TinyGo in a cached directory

    This commit changes the way that packages are looked up. Instead of
    working around the loader package by modifying the GOROOT variable for
    specific packages, create a new GOROOT using symlinks. This GOROOT is
    cached for the specified configuration (Go version, underlying GOROOT
    path, TinyGo path, whether to override the syscall package).
    
    This will also enable go module support in the future.
    
    Windows is a bit harder to support, because it only allows the creation
    of symlinks when developer mode is enabled. This is worked around by
    using symlinks and if that fails, using directory junctions or hardlinks
    instead. This should work in the vast majority of cases. The only case
    it doesn't work, is if developer mode is disabled and TinyGo, the Go
    toolchain, and the cache directory are not all on the same filesystem.
    If this is a problem, it is still possible to improve the code by using
    file copies instead.
    
    As a side effect, this also makes diagnostics use a relative file path
    only when the file is not in GOROOT or in TINYGOROOT.
    aykevl committed May 23, 2020
    Configuration menu
    Copy the full SHA
    95ec745 View commit details
    Browse the repository at this point in the history
  4. loader: load packages using Go modules

    This commit replaces the existing ad-hoc package loader with a package
    loader that uses the x/tools/go/packages package to find all
    to-be-loaded packages.
    aykevl committed May 23, 2020
    Configuration menu
    Copy the full SHA
    ba9741f View commit details
    Browse the repository at this point in the history