github.com/dtroyer-salad/og2/v2@v2.0.0-20240412154159-c47231610877/MIGRATION_GUIDE.md (about)

     1  # Migration Guide
     2  
     3  In version `v2`, ORAS Go library has been completely refreshed with:
     4  
     5  - More unified interfaces
     6  - Notably fewer dependencies
     7  - Higher test coverage
     8  - Better documentation
     9  
    10  **Besides, ORAS Go `v2` is now a registry client.**
    11  
    12  ## Major Changes in `v2`
    13  
    14  - Moves `content.FileStore` to [file.Store](https://pkg.go.dev/oras.land/oras-go/v2/content/file#Store)
    15  - Moves `content.OCIStore` to [oci.Store](https://pkg.go.dev/oras.land/oras-go/v2/content/oci#Store)
    16  - Moves `content.MemoryStore` to [memory.Store](https://pkg.go.dev/oras.land/oras-go/v2/content/memory#Store)
    17  - Provides [SDK](https://pkg.go.dev/oras.land/oras-go/v2/registry/remote) to interact with OCI-compliant and Docker-compliant registries
    18  - Supports [Copy](https://pkg.go.dev/oras.land/oras-go/v2#Copy) with more flexible options
    19  - Supports [Extended Copy](https://pkg.go.dev/oras.land/oras-go/v2#ExtendedCopy) with options *(experimental)*
    20  - No longer supports `docker.Login` and `docker.Logout` (removes the dependency on `docker`); instead, provides authentication through [auth.Client](https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/auth#Client)
    21  
    22  Documentation and examples are available at [pkg.go.dev](https://pkg.go.dev/oras.land/oras-go/v2).
    23  
    24  ## Migrating from `v1` to `v2`
    25  
    26  1. Get the `v2` package
    27  
    28      ```sh
    29      go get oras.land/oras-go/v2
    30      ```
    31  
    32  2. Import and use the `v2` package
    33  
    34      ```go
    35      import "oras.land/oras-go/v2"
    36      ```
    37  
    38  3. Run
    39  
    40     ```sh
    41     go mod tidy
    42      ```
    43  
    44  Since breaking changes are introduced in `v2`, code refactoring is required for migrating from `v1` to `v2`.  
    45  The migration can be done in an iterative fashion, as `v1` and `v2` can be imported and used at the same time.