Verified Commit 95aa8491 authored by Jimmy Spagnola's avatar Jimmy Spagnola Committed by GitLab
Browse files

fix(config): return a client-go/v3 client from config.NewClient()

Changelog: Improvements
parent e1740dc4
Loading
Loading
Loading
Loading
+12 −11
Changes for README.md: 12 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -7,18 +7,18 @@ A GitLab API client enabling Go programs to interact with GitLab in a simple and

[[_TOC_]]

## `client-go` 2.0 Has Been Released!
## `client-go` 3.0 Has Been Released!

We're pleased to announce that version 2.0 has been released for the `client-go` library, which continues our
We're pleased to announce that version 3.0 has been released for the `client-go` library, which continues our
backwards compatibility guarantee introduced in the 1.0 release by ensuring all breaking changes are included
in a major release version to follow SemVar. For the release 2.0 migration guide, please see the
in a major release version to follow SemVar. For the release 3.0 migration guide, please see the
[Migration Guides](#migration-guides) section below!


## Usage

```go
import "gitlab.com/gitlab-org/api/client-go/v2"
import "gitlab.com/gitlab-org/api/client-go/v3"
```

Construct a new GitLab client, then use the various services on the client to
@@ -65,7 +65,7 @@ package main
import (
	"log"

	"gitlab.com/gitlab-org/api/client-go/v2"
	"gitlab.com/gitlab-org/api/client-go/v3"
)

func main() {
@@ -103,7 +103,7 @@ func main() {

#### Use OAuth2 helper package

The following example demonstrates how to use the `gitlab.com/gitlab-org/api/client-go/v2/oauth2` package:
The following example demonstrates how to use the `gitlab.com/gitlab-org/api/client-go/v3/oauth2` package:

```go
package main
@@ -113,8 +113,8 @@ import (
	"fmt"
	"os/exec"

	gitlab "gitlab.com/gitlab-org/api/client-go/v2"
	"gitlab.com/gitlab-org/api/client-go/v2/gitlaboauth2"
	gitlab "gitlab.com/gitlab-org/api/client-go/v3"
	"gitlab.com/gitlab-org/api/client-go/v3/gitlaboauth2"
)

func main() {
@@ -194,7 +194,7 @@ import (
	"log"

	"gitlab.com/gitlab-org/api/client-go/config/v2"
	"gitlab.com/gitlab-org/api/client-go/v2"
	"gitlab.com/gitlab-org/api/client-go/v3"
)

func main() {
@@ -241,12 +241,12 @@ For complete usage of `client-go`, see the full [package docs](https://pkg.go.de
To install the library, use the following command:

```go
go get gitlab.com/gitlab-org/api/client-go/v2
go get gitlab.com/gitlab-org/api/client-go/v3
```

## Testing

The `client-go` project comes with a `testing` package at `gitlab.com/gitlab-org/api/client-go/v2/testing`
The `client-go` project comes with a `testing` package at `gitlab.com/gitlab-org/api/client-go/v3/testing`
which contains a `TestClient` with [gomock](https://github.com/uber-go/mock) mocks for the individual services.

You can use them like this:
@@ -309,6 +309,7 @@ major release will publish a migration guide to help users migrate from the prev

- [Migration Guide for 0.X -> 1.X](docs/release-1.0-migration.md)
- [Migration Guide for 1.X -> 2.X](docs/release-2.0-migration.md)
- [Migration Guide for 2.X -> 3.X](docs/release-3.0-migration.md)

## Contributing

+2 −2
Changes for config/config.go: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ import (
	"buf.build/go/protoyaml"
	"github.com/zalando/go-keyring"
	"gitlab.com/gitlab-org/api/client-go/config/v2/v1beta1"
	gitlab "gitlab.com/gitlab-org/api/client-go/v2"
	"gitlab.com/gitlab-org/api/client-go/v2/gitlaboauth2"
	gitlab "gitlab.com/gitlab-org/api/client-go/v3"
	"gitlab.com/gitlab-org/api/client-go/v3/gitlaboauth2"
	"golang.org/x/oauth2"
	"golang.org/x/time/rate"
	"google.golang.org/protobuf/types/known/structpb"
+1 −1
Changes for config/config_test.go: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ import (
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"gitlab.com/gitlab-org/api/client-go/config/v2/v1beta1"
	gitlab "gitlab.com/gitlab-org/api/client-go/v2"
	gitlab "gitlab.com/gitlab-org/api/client-go/v3"
)

func TestConfig_EmptyConfig(t *testing.T) {
+1 −1
Changes for config/examples/basic_usage.go: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ import (

	"github.com/MakeNowJust/heredoc/v2"
	"gitlab.com/gitlab-org/api/client-go/config/v2"
	gitlab "gitlab.com/gitlab-org/api/client-go/v2"
	gitlab "gitlab.com/gitlab-org/api/client-go/v3"
)

func main() {
+1 −1
Changes for config/go.mod: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ require (
	github.com/MakeNowJust/heredoc/v2 v2.0.1
	github.com/stretchr/testify v1.12.1
	github.com/zalando/go-keyring v0.2.8
	gitlab.com/gitlab-org/api/client-go/v2 v2.13.0
	gitlab.com/gitlab-org/api/client-go/v3 v3.13.0
	go.yaml.in/yaml/v3 v3.0.5
	golang.org/x/oauth2 v0.36.0
	golang.org/x/time v0.15.0
Loading