-
-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathconfig_test.go
More file actions
31 lines (26 loc) · 670 Bytes
/
config_test.go
File metadata and controls
31 lines (26 loc) · 670 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package gerrit_test
import (
"context"
"fmt"
"github.com/andygrunwald/go-gerrit"
)
func ExampleConfigService_GetVersion() {
instance := "https://gerrit-review.googlesource.com/"
ctx := context.Background()
client, err := gerrit.NewClient(ctx, instance, nil)
if err != nil {
panic(err)
}
v, _, err := client.Config.GetVersion(ctx)
if err != nil {
panic(err)
}
// We can`t output the direct version here, because
// the test would fail if gerrit-review.googlesource.com
// will upgrade their instance.
// To access the version just print variable v
if len(v) > 0 {
fmt.Println("Got version from Gerrit")
}
// Output: Got version from Gerrit
}