github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/README.md (about)

     1  [govpp](https://github.com/FDio/govpp/blob/master/README.md) is a go binding for the vpp api
     2  
     3  This repo provides the go binding for a version of vpp.
     4  
     5  ```go
     6  import "github.com/edwarnicke/govpp/binapi"
     7  ```
     8  
     9  This repo also provides minimal docker containers for running vpp:
    10  
    11  - [vpp](https://github.com/users/edwarnicke/packages/container/package/govpp%2Fvpp)
    12  - [vpp-dbg](https://github.com/users/edwarnicke/packages/container/package/govpp%2Fvpp) - debug image
    13  
    14  ## How to match the version of vpp you want to the go bindings.
    15  
    16  Whenever a combination of [VPP_VERSION](https://github.com/edwarnicke/govpp/blob/e0e3b4843cf510bccc6e6a6eac43729a5e5fa42f/Dockerfile#L1)
    17  and [cherrypicks/patches](https://github.com/edwarnicke/govpp/blob/e0e3b4843cf510bccc6e6a6eac43729a5e5fa42f/patch/patch.sh) is used to build vpp/vpp-dbg docker containers,
    18  they will be tagged in the docker repo.  The corresponding tag will be laid on the main branch containing the corresponding
    19  binapi.
    20  
    21  So simply run in the same directory as your go.mod file:
    22  
    23  ```bash
    24  go get github.com/edwarnicke/govpp/binapi@${tag}
    25  ```
    26  
    27  Where `${tag}` is the tag of the vpp container you are consuming.
    28  
    29  For example:
    30  
    31  ```bash
    32  go get github.com/edwarnicke/govpp/binapi@v21.06.0-9-16f166164
    33  ```
    34  
    35  To set your go dependency for govpp to match the docker container you are using.
    36  
    37  ## What to do if you need a different version of vpp:
    38  
    39  If you want a version of VPP, you can fork *this* repo and add it yourself.
    40  Because things are very heavily patterned and generated, its really quite easy:
    41  
    42  1. Change default value for ARG VPP_VERSION in [Dockerfile](https://github.com/edwarnicke/govpp/blob/main/Dockerfile#L1) to the vpp tag or commit id you want to build.
    43  2. ```go generate ./...```
    44  3. Add a GHCR_TOKEN secret to your fork containing a PAT allowing you to push to your [Github Container Registry](https://docs.github.com/en/free-pro-team@latest/packages/managing-container-images-with-github-container-registry/pushing-and-pulling-docker-images)
    45  4. Push a PR to your fork and merge it.  This will push the vpp and vpp-dbg images to your repo.
    46  
    47  ## What to do if you need to cherrypick into VPP
    48  
    49  See [patch/patch.sh].  Simply add your cherrypicks to that file.
    50  
    51  ## What to do if you need to patch vpp:
    52  
    53  If you want to add patches to vpp simply add them with the `.patch` suffix to the [patch/](https://github.com/edwarnicke/govpp/blob/main/patch/) directory.
    54  
    55  ## What to do if you need a different version of govpp
    56  
    57  Change the version of [govpp in the go.mod file](https://github.com/edwarnicke/govpp/blob/main/go.mod#L5)
    58  
    59  ## How the magic works ##
    60  
    61  See [How the Magic Works](https://github.com/edwarnicke/govpp/issues/16).