andygrunwald / go-gerrit

Go client/library for Gerrit Code Review
https://godoc.org/github.com/andygrunwald/go-gerrit
MIT License
95 stars 40 forks source link

function 'CheckAccountCapability' canot Unmarshal request body #166

Open shijl0925 opened 5 months ago

shijl0925 commented 5 months ago
package main

import (
    "context"
    gerrit "github.com/andygrunwald/go-gerrit"
    "log"
)

func main() {
    ctx := context.Background()
    instance := "http://127.0.0.1:8080/"
    client, _ := gerrit.NewClient(ctx, instance, nil)
    client.Authentication.SetBasicAuth("admin", "xxx")

    cap, _, err := client.Accounts.CheckAccountCapability(ctx, "admin", "createGroup")
    log.Printf("err: %v", err)
    log.Printf("capability: %s\n", cap)
}

2024/06/01 13:10:41 err: invalid character 'o' looking for beginning of value 2024/06/01 13:10:41 capability:

shijl0925 commented 5 months ago

The checks result of a user has "createGroup" capability should be "ok". I guess the function 'CheckAccountCapability' has a bug. And the gerrit server version is "3.8.0". Go version is "1.21.10".

andygrunwald commented 5 months ago

Thanks @shijl0925 I don't have time to look deeply at it right now. Are you able to debug it? Happy to accept a PR.