Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Merge requests
  • !449

Add some support for running go tests.

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Mike Kaplinskiy requested to merge github/fork/mikekap/golang_test into master Oct 05, 2015
  • Overview 28
  • Commits 1
  • Pipelines 0
  • Changes 33

This isn't as complete as the go test command, mostly because go test "magically" recompiles the package under test. The closest you can get to go test-like functionality is via duplication, as mentioned in the docs. It might be nice to make this easier via param or different test rule (go_internal_test) that just does the src/dep copying for you. We may be able to make this even more amazing via some sort of auto-discovery (we can easily tell if the test is external or internal at test main generation time) and create two different libs. But I digress; this is a v1.

This also fixes support for custom package names (was previously somewhat broken).

The slightly more controversial feature here is the test main generator. Particularly, the source (in go) is a) mostly ripped from https://github.com/golang/go/blob/master/src/cmd/go/test.go & b) checked in as the source. In order to actually use it at run-time, it creates a "fake" test target //__internal_buck:go_test_main_gen. This is mostly to allow you to build buck without having go installed. I'm not sure of a better way to do this, so any ideas are appreciated.

Tested via the integration tests - they work :)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/mikekap/golang_test