go-gerrit icon indicating copy to clipboard operation
go-gerrit copied to clipboard

function 'CheckAccountCapability' canot Unmarshal request body

Open shijl0925 opened this issue 1 year ago • 2 comments

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 avatar Jun 01 '24 05:06 shijl0925

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".

shijl0925 avatar Jun 01 '24 05:06 shijl0925

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.

andygrunwald avatar Jun 01 '24 09:06 andygrunwald