GithubHelp home page GithubHelp logo

sarvex / pants-example-golang Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pantsbuild/example-golang

0.0 1.0 1.0 26 KB

An example repo to demonstrate Go support in Pants v2

License: Apache License 2.0

Shell 9.74% Go 62.52% Starlark 27.74%

pants-example-golang's Introduction

example-golang

An example repository to demonstrate Pants's experimental Golang support.

See the Golang blog post for some unique benefits Pants brings to Golang repositories, and see pantsbuild.org/docs/go-overview for more detailed documentation.

This is only one possible way of laying out your project with Pants. See pantsbuild.org/docs/source-roots#examples for some other example layouts.

Running Pants

You run Pants goals using the pants launcher binary, which will bootstrap the version of Pants configured for this repo if necessary.

See here for how to install the pants binary.

Goals

Pants commands are called goals. You can get a list of goals with

pants help goals

Most goals take arguments to run on. To run on a single directory, use the directory name with : at the end. To recursively run on a directory and all its subdirectories, add :: to the end.

For example:

pants lint cmd: internal::

You can run on all changed files:

pants --changed-since=HEAD lint

You can run on all changed files, and any of their "dependees":

pants --changed-since=HEAD --changed-dependees=transitive test

Example Goals

Try these out in this repo!

Run Gofmt

pants fmt ::  # Format all packages.
pants fmt cmd/greeter_en:  # Format only this package.
pants lint pkg::  # Check that all packages under `pkg` are formatted.

Check compilation

pants check ::  # Compile all packages.
pants check cmd/greeter_en:  # Compile only this package and its transitive dependencies.

Run tests

pants test ::  # Run all tests in the repository.
pants test pkg/uuid:  # Run all the tests in this package.
pants test pkg/uuid: -- -run TestGenerateUuid  # Run just this one test.

Create a binary file

Writes the result to the dist/ folder.

pants package cmd/greeter_en:
pants package cmd::  # Create all binaries.

Run a binary

pants run cmd/greeter_en:
pants run cmd/greeter_es: -- --help

Determine dependencies

pants dependencies cmd/greeter_en:
pants dependencies --transitive cmd/greeter_en:

Determine dependees

That is, find what code depends on a particular package(s).

pants dependees pkg/uuid:
pants dependees --transitive pkg/uuid: 

Count lines of code

pants count-loc '**/*'

pants-example-golang's People

Contributors

eric-arellano avatar benjyw avatar stuhood avatar

Watchers

 avatar

Forkers

gizlang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.