github.com/ktr0731/dept@v0.1.4-0.20191208040738-06ee3ca97c03/README.md (about)

     1  # dept
     2  
     3  [![CircleCI](https://circleci.com/gh/ktr0731/dept.svg?style=svg)](https://circleci.com/gh/ktr0731/dept)
     4  [![codecov](https://codecov.io/gh/ktr0731/dept/branch/master/graph/badge.svg?token=GLDI0EuIJs)](https://codecov.io/gh/ktr0731/dept)  
     5  
     6  [Go modules](//github.com/golang/go/wiki/Modules) based dependency management for Go tools.
     7  
     8  ## Description
     9  `dept` is a dependency management tool based on [Go modules](//github.com/golang/go/wiki/Modules).  
    10  Instead of `go.mod`, `dept` helps you to manage Go tools. 
    11  Go tools like [Golint](https://github.com/golang/lint), [errcheck](https://github.com/kisielk/errcheck) are often used in various environment.
    12  `dept` provides you deterministic builds by manage tool dependencies.
    13  
    14  `dept` is based on Go modules. All dependency resolution are provided by `go mod` commands.
    15  
    16  ## Requirements
    17  - Go v1.13 or later
    18  
    19  ## Basic usage
    20  At first, let's create `gotool.mod` in a project root by the following command.
    21  All tools which are managed by `dept` are written to `gotool.mod`.
    22  
    23  ``` sh
    24  $ dept init
    25  ```
    26  
    27  Then, let's install Go tools you want to use in your project.
    28  ``` sh
    29  $ dept get github.com/mitchellh/gox github.com/tcnksm/ghr@v0.12.0
    30  $ dept get -o lint github.com/golangci/golangci-lint/cmd/golangci-lint # rename golangci-lint as 'lint'
    31  ```
    32  
    33  Finally, use `exec` to execute installed commands.
    34  ``` sh
    35  $ dept exec ghr -v
    36  ghr version v0.12.0
    37  ```
    38  
    39  If you want to installed commands without `dept`, please run `build`.
    40  ``` sh
    41  $ dept build
    42  $ ls _tools
    43  ghr     gox     lint
    44  ```
    45  
    46  ## Available commands
    47  ### init
    48  ``` sh
    49  $ dept init
    50  ```
    51  
    52  ### get
    53  `dept get` installs binaries to the specified directory.
    54  
    55  ``` sh
    56  $ dept get github.com/mitchellh/gox 
    57  ```
    58  
    59  You can select the specified version like Go modules:
    60  ``` sh
    61  $ dept get github.com/mitchellh/gox@v0.3.0
    62  $ dept get github.com/mitchellh/gox@v0.1.0
    63  ```
    64  
    65  To install a binary with another name:
    66  ``` sh
    67  $ dept get -o lint github.com/golangci-lint/cmd/golangci-lint
    68  ```
    69  
    70  Update tools to the latest version:
    71  ``` sh
    72  $ dept get -u github.com/mitchellh/gox
    73  $ dept get -u # update all tools
    74  ```
    75  
    76  ### remove
    77  `dept remove` uninstalls passed tools.
    78  
    79  ``` sh
    80  $ dept remove github.com/mitchellh/gox
    81  ```
    82  
    83  ### exec
    84  `dept exec` executes the passed tool with arguments.
    85  
    86  ``` sh
    87  $ dept exec ghr -v
    88  ```
    89  
    90  ### build
    91  `dept build` builds all tools.
    92  
    93  ``` sh
    94  $ dept build
    95  ```
    96  
    97  If `$GOBIN` enabled, it will be used preferentially.
    98  ``` sh
    99  $ GOBIN=$PWD/bin dept build
   100  ```
   101  
   102  Also, `-d` flag is provided.
   103  ``` sh
   104  $ dept build -d bin
   105  ```
   106  
   107  ### list
   108  `dept list` list ups all tools managed by `dept`.
   109  
   110  ``` sh
   111  $ dept list
   112  github.com/golangci/golangci-lint/cmd/golangci-lint lint v1.12.3
   113  github.com/mitchellh/gox gox v0.4.0
   114  github.com/tcnksm/ghr ghr v0.12.0
   115  ```
   116  
   117  You can format output with `-f` flag.
   118  ``` sh
   119  $ dept list -f '{{ .Name }}'
   120  lint
   121  gox
   122  ghr
   123  ```
   124  
   125  ### clean
   126  `dept clean` cleans up all cached tools.
   127  
   128  ``` sh
   129  $ dept clean
   130  ```