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

Add support for Go modules #751

Merged
merged 6 commits into from Oct 30, 2019
Merged

Add support for Go modules #751

merged 6 commits into from Oct 30, 2019

Commits on Oct 29, 2019

  1. Switch to Go modules

    This switches Zap to using Go modules.
    
    To keep the list of direct dependencies of Zap minimal, benchmarks are
    placed in their own Go module as per [Multi-Module Repositories][1].
    
    This change deletes the glide.lock but keeps the glide.yaml around for
    legacy ecosystems.
    
    [1]: https://github.com/golang/go/wiki/Modules#faqs--multi-module-repositories
    abhinav committed Oct 29, 2019
    Copy the full SHA
    2b8d050 View commit details
    Browse the repository at this point in the history
  2. global_test: Fix for modules

    With Go modules, the location of global_test on disk does not have to be
    in `$GOPATH/src/go.uber.org/zap`, or even in a directory named `zap`.
    This simplifies the assertion to verify just the file name.
    abhinav committed Oct 29, 2019
    Copy the full SHA
    b94a57a View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2019

  1. TestStacktraceFiltersVendorZap: Fix for modules

    This fixes TestStacktraceFiltersVendorZap to work with Go modules.
    
    For context, the test previously did the following:
    
    - Set up a temporary GOPATH
    - Copy stacktrace_ext_test.go into it
    - Symlink Zap and relevant dependencies into a vendor/ directory in the
      temporary GOPATH
    - Run specific tests from stacktrace_ext_test.go with Zap inside the
      vendor/ directory
    
    We're no longer using GOPATH or vendor/ directories, but this behavior
    of Zap when *it* is inside a vendor/ directory should be retained.
    
    To that end, this changes TestStacktraceFiltersVendorZap to continue to
    run with the following changes:
    
    - Use `go mod download -json` to retrieve the locations of all of Zap's
      dependencies on-disk, and symlink them into the temporary GOPATH's
      vendor/.
    - Explicitly set `GO111MODULE=off` before running `go test` because we
      may be running in an environment where `GO111MODULE=on` is set.
    abhinav committed Oct 30, 2019
    Copy the full SHA
    0b1db79 View commit details
    Browse the repository at this point in the history
  2. internal/readme: Use benchmarks submodule

    The benchmarks package has been placed inside its own module so that its
    dependencies are not considered Zap's dependencies.
    
    This changes the README update script to run the benchmark inside the
    benchmark module's directory since we can no longer invoke it from Zap's
    top-level directory.
    abhinav committed Oct 30, 2019
    Copy the full SHA
    e5042c3 View commit details
    Browse the repository at this point in the history
  3. ci: Use Go modules and ./...

    This switches the Makefile and travis setup to rely on Go modules and
    `./...` instead of `glide nv`.
    
    Note that a tradeoff of making `benchmarks/` its own module is that
    `./...` in the Zap directory will no longer include the `benchmarks/`
    directory. So where necessary, we need to run commands separately in
    that directory as well, which complicates the build script ever so
    slightly.
    abhinav committed Oct 30, 2019
    Copy the full SHA
    8ed5ac4 View commit details
    Browse the repository at this point in the history
  4. ci: Manage lint decision in travis.yml

    Rather than hard-coding the Go version we lint against in the Makefile,
    this switches to managing that in the .travis.yml -- the same place we
    manage the versions we're testing against.
    abhinav committed Oct 30, 2019
    Copy the full SHA
    39ba1b2 View commit details
    Browse the repository at this point in the history